I made it: my Twine (Harlowe) has become nearly unplayable due to performance. The fastest passage takes more than 4 seconds to render, it freezes the browser for most of that time, and it will surely get slower as I add more content.
Can you think of any way or tool for analyzing the performance of a game and seeing what's making it slow? One of the problems is that I actually think that the game should be way faster, since I thought that I had streamlined its "engine" from a previous version that, however, is faster than the current. So I don't even know where to look.
Comments
Without looking are your story project it is hard to advise what may be effecting your story by some common problems are:
a. Image / Audio / Video files that are not being cached.
b. Over use of macros like (live:) and (history:)
c. Passage text that is overly dynamic. (eg. over using/nesting (if:) macros)
In my case, the cause is c. As I put it here:
This is a bit obsolete: I have changed (live:) loops for a subarray method, and I have added a few more (if:). I know I'm not using Twine the way it's supposed to be used, but, on the other hand, learning Javascript or something like that is way beyond me at the point.
Basically each time a Passage is shown to the Reader it's contents is parsed by the story format's Javascript based engine which converts that contents into either HTML elements (possibly with attached Javascript code) or more Javascript code which is executed, finally the outcome of all that is injected into the current page.
This is also done to each passage that is displayed/referenced within the Passage being shown.
So basically there are only two things to profile, the Javascript engine doing the parsing/conversion/processing/injection , and the Javascript code being generated/referenced by the newly created HTML elements.