Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Any method for analyzing performance?

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

  • edited April 2016
    The Story HTML file generated by Twine is a web-application so you should be able to use many of the techniques/utilities used by Web Developers to profile your story, including those built into your web-browser.

    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)
  • edited April 2016
    Thanks. But developer tools show Javascript. Is there any practical way of mapping that to the original Harlowe code or is it unfeasible, only debuggable by hand by a Javascript-knowing dev?

    In my case, the cause is c. As I put it here:
    Each passage you enter typically runs:
    * Between 5 and 15 (display:)
    * 7 large datamaps are checked to extract values (datamaps between 10 and maybe 100 values, and some of those values are other datamaps or arrays)
    * 20 (if:), more or less
    * A couple of (live:) pseudoloops wrapping much of this

    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.
  • Menti wrote: »
    Is there any practical way of mapping that to the original Harlowe code
    To paraphrase Mr Pratchett "It is Javascript all the way down".

    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.
Sign In or Register to comment.