In the course of working on Hadean Lands, I’ve done some profiling work. This game is supposed to wind up on mobile devices, after all. (iOS CPUs have sped up orders of magnitude since I started this project, but still…)
I7’s library (and the Standard Rules) have a few trouble spots – places where the library iterates through the entire object list, or the list of the “thing” class. Most of these occur in the “look” action. This is not a big deal in a medium-sized game, but my game contains 800 objects (420 things), so it turns into a noticeable slowdown.
I’ve extracted my performance improvements and posted them as an extension:
This will only work with the current Inform build, 6G60. Yes, there’s a big I7 update due in a week and a half, and I’ll have to update my extension for that. I’ll keep links to both versions up, actually, because some authors may not want to spend the effort to transition a large game over to the new Inform.
If you want to replicate my profiling work, you can recompile Glulxe with the VM_PROFILING option.
A simpler alternative, which doesn’t do full profiling but just gives a total of CPU cycles and milliseconds per command: check out the “debugging” branches of Glulxe and CheapGlk. (github.com/erkyrath/cheapglk/tree/debugger) Build Glulxe with the VM_DEBUGGER option and then run with the options:
Wow! This looks cool! An initial full-test walkthrough of A Roiling Original sped up 10%, and that’s before using the “empty” adjective and so forth. (Though I haven’t run anything replicable.)
The looking and locale priority seem to be a heck of a lot quicker. I expect I’d get >>10% if the game didn’t go to town on indexed text for its core mechanic.
Yeah, my WriteListFrom changes were incorrect. I’ve uploaded version 2, which is not as fast but should behave correctly. I’ll think about better ways to improve that.
I haven’t found other bugs, but I’ve hit a big game pretty hard with test scripts and found no differences with version 2 vs. my game without either versions. So that seems good.
Out of curiosity, in the example given for the extension, why do you declare “There are 50 clones.” eight times instead of, say, “There are 100 clones.” 4 times?
I added a small change which knocks another big chunk off the execution time. (Highly optimized replacements for lines like “now all things are not mentioned”.)
This looks very cool. You mentioned you were planning to make a version for the new build. Please let us know if you have! I’d love to try it out as my game has a few thousand objects now and it is definitely slow on “look”.
I think I am going to wait for the bug-fix I7 release. At least one of the mechanisms I’m hacking (the grouping-together activity) will be changed under the covers.