4 ms·
Perhaps this could be a good start for another coding contest: The most inefficient webpage. The object: take a copy of the Google search page and represent it
by stcredzero 16y ago
Perhaps this could be a good start for another coding contest: The most inefficient webpage.
The object: take a copy of the Google search page and represent it in the most inefficient, bloated way possible. There would be two divisions: time-bloat and space-bloat.
Rules: Every piece of code must be involved in displaying something visibly on the page. Every statement in the Javascript must be making forward progress toward displaying the page.
The functionality of the page must be exactly the same as the original.
Any other rules?
(There wouldn't be any loading and waiting on external resources, of course.)
- viraptor 16y agoCalculate `h=SHA256(original_page)` and `n=len(original_page)`. do page = gen_random_bytes(n) while (h != SHA256(page)) print page It can be even generated client-side!
- wwortiz 16y agoCan't the same hash mean different data?
- viraptor 16y agoWell, sure. But if you add another check for likelihood that `page` is fairly-correct html in utf8, there should be around one correct result really :) If you get 2, the other one is probably a <form> you can use to sell your soul to satan - do not hit submit if you get it.
- stcredzero 16y agoThe problem with this, is that the random bytes in one iteration of the loop might be closer to the page than the next iteration, so there would be reverse progress in that instance. This entry would be disqualified.
- meric 16y agopage_bytes = bytes(size_of(bytes_of(page))) do page_bytes += 1 while (page_bytes != bytes_of(page)) print page