Very nice! Thank you for this!
FYI, searching a 100-member list for a given value takes roughly 28 times as long (assuming that it's toward the end of the list) as simply retrieving the value from a given slot of the same list:
Quote:
Test results
Searching a simple list:
202.82µs ±0.14% (24652 samples)
Selecting from a simple list:
7.05µs ±0.58% (93902 samples)
Total running time: 10000080µs
Not earth-shattering, but it is interesting to me how much longer a search takes versus a simple access.
I do have a couple of UI suggestions:
1) The game closes down immediately a few moments after finishing the last test. In Gargoyle, this means that the game window closes too. Please offer the user the chance to either rerun the tests or quit at the end, and don't quit without the pressing of an explicit key. It takes a long time to run any of the simple tests I'm trying, and it's really annoying to have the window just close in your face when they finish!
2) Currently it is a bit hard to customize the conditions for a test. For example, if I need to set up a list full of random data for my test(s) to work on, I need to do something like this:
Code:
First when play begins:
repeat with x running from 1 to 99:
add a random number between 1 and 99 to search list;
add 100 at entry 90 in search list;
say "The search list is [number of entries in search list] items long: ";
say search list in brace notation;
wait for any key.
What's difficult? First, the user needs to remember to add "first" to the when play begins rule to ensure that his rule prints before the program is taken over by the benchmarker; changing the benchmarker control rule to "
last when play begins" would eliminate this problem. Second, if the user wants to print text in this code block, he needs to stick something like "wait for any key" in there; this calls glk_select. Most users won't realize that this is necessary and will bang their heads on the wall trying to figure out why their introductory text is not printing. Maybe a "press any key to begin" in the benchmarker's when play begin rule would fix this?