kamalmarhubi / one-second

Fun performance game!
http://computers-are-fast.github.io/
387 stars 22 forks source link

Random notes #19

Open didib opened 2 years ago

didib commented 2 years ago

Great game! :-)

Some comments:

  1. You are welcome to play with grep on shorter/longer search strings, non-zero input (random or not), locale (force it or not force to handle unicode), etc., and then either do nothing (as the grep question is already interesting as is), or add more text, or split to more questions. And perhaps mention/link to the boyer-moore algo (e.g. on wikipedia) - I still remember my fascination when learning it many years ago...
  2. fill_array*.c do quite a lot more than writing to memory. Specifically, 'array[i] = j' and 'array[j] = j' are writing ints to a char/byte array. I didn't check the assembly language result, but I am pretty certain that you either write 4 bytes in a loop, or spend at least some time on not writing (coercing the int to byte). Not sure how to best fix this - perhaps you should create a small array (that will fit in cache) and copy it to the larger one, or perhaps at least make the array of int's (and use sizeof for determining the amount written), not sure.
  3. Perhaps consider rewriting download_webpage.py to be more systematic/methodical - perhaps run a local web server, perhaps one with designed-in simulated latency (if you can find one, or just write one, or use some network simulator). I wouldn't be surprised if google rate-limits you - in addition to what you already mentioned about network speed/latency. I realize that simulating a 'get something over the Internet' is interesting in itself, though... I also do not think it's that fair against google, although I guess so few people actually run this thing that it's a non-issue.