angstsmurf / spatterlight

Updated fork of Spatterlight
GNU General Public License v3.0
105 stars 5 forks source link

Spatterlight slows down as the transcript grows #10

Closed dfabulich closed 3 years ago

dfabulich commented 4 years ago

I was playing The Wizard Sniffer today, a not-too-long IFComp game, and I noticed that in the course of play, typing commands got slower and slower. By the end, it was taking almost a full second for each command.

When I cleared the transcript, the game got fast again.

(I'm using Spatterlight 0.5.12b on macOS Catalina 10.15.4, on a 2019 16" MBP.)

dfabulich commented 4 years ago

I believe Lectrote avoids this fate by capping the length of the transcript, which is a pity.

angstsmurf commented 4 years ago

Thanks for the report!

I think what we are talking about here is the scrollback, not the transcript files created by the SCRIPT ON command, right? The menu items Clear Transcript and Save Transcript should definitely be renamed to Clear Scrollback and Save Scrollback to avoid this confusion.

In theory, typing commands should be no slower than editing a RTF file of the same size in TextEdit, as Spatterlight uses the same Cocoa system libraries, so I'll have to look into what it is that slows things down. Does closing it and autorestoring make it better or worse?

If you encounter this problem again, it would be great if you were able to send me the autosave files. They are named autosave-GUI.plist, autosave.plist and autosave.glksave, and hidden in a folder with a very long name consisting of a lot of numbers, inside ~/Library/Application Support/Spatterlight/Glulxe Files/Autosaves, probably 476c756c00030102000ddf000011840000118400000100000000003c0009f596c5e521d9496e666f00010000362e3333302e33380001313731303037c1000030. There will also be a file named The Wizard Sniffer.txt in there.

dfabulich commented 4 years ago

Closing and autorestoring does seem to fix the performance issue, without clearing scrollback, which is good to know.

Unfortunately, I therefore doubt that this autosave will be useful, but, what the heck, here you go. autosave.zip

FWIW, I can easily reproduce this problem in a ten minute speed run through the game.

angstsmurf commented 4 years ago

Thanks! It turns out that The Wizard Sniffer does something weird where it resizes its windows on every turn (seems to be to one-line status window height and then back to two lines,) which triggers some calculations which are slow when the scrollback is huge.

The good news is that this is the only game I've found which does this. I've also pushed some minor optimisations which seem to remove most of the slowness.

angstsmurf commented 3 years ago

This should be much improved in 0.5.13b.