Gradual Slowdown/Script Errors in Quixe?

I’m playing Under, In Erebus in Quixe (with exit listings on) and it seems to be gradually slowing down on me – the first few turns went quickly, but 80-100 turns in I’m getting slow response times, temporary browser freezes, and unresponsive script errors. (Sometimes it takes around five unresponsive script errors for one command to be processed.) Does anyone else have similar problems?

At first this was happening in Firefox 10.6.12 on OS X 10.5.8, then I switched to Safari 5.0.2 (running nothing but the game) and got the same slowdown. My computer is a bit old and tetchy so that might be it. Saving, quitting, and restoring seems to help for a few turns but not for long.

Do you meaning Firefox 3.6 rather than 10.6? :stuck_out_tongue:

If you go (in FF) to Tools->Error console, does anything interesting come up? Clear it before you load Quixe as there’ll be lots of errors from other web pages.

Is your memory usage increasing the more you play?

Well, I got five of these:

github.com : server does not support RFC 5746, see CVE-2009-3555

but those seemed to happen before I restored my save, and so before I got the beachball. (In FF, I start, type restore, and those go fine, and then I look and it beachballs for about ten seconds.)

I also get “declaration dropped” for “margin” but I vaguely recall those aren’t a big deal.

I’m not actually sure how to check my memory usage.

It sounds like some part of the code is leaking memory. (In which case there won’t be any error messages.)

That shouldn’t be happening. (Nothing in the code should be allocating forever without limit.) But, well, apparently it is.

The other possibility is that the amount of code is too large for your computer’s memory. Quixe compiles each chunk of code the first time it’s executed. Maybe there are just too many chunks. The pattern you saw seems to suggest this: when you start from the beginning of the game only a small amount of the game code gets used, but when you restore to the middle, many more objects are in play.

When you say you tried “saving, quitting, and restoring” did you quit Firefox entirely?

I meant saving the game, closing the window, reopening it, and restoring the game. I think I did quit Firefox once in there too, though (though I had it reopen the immense number of tabs I was using). Going to try quitting Safari and restarting it…

…nope, quitting Safari, reopening it, going back to the page, restoring my save file (242 turns in), and typing “look” and another command, I got two unresponsive script errors. It might just be that Quixe is breaking my computer here. Oh well.

Do you have similar problems with Parchment?

Nope – made it 310 moves into Annoyotron in Firefox without any slowdown. (Paradoxically, chosen as the least annoying game to do hundreds of turns in for testing purposes alone.)

I do have a weird thing in Firefox at the moment where my input is typed below the command prompt, which is a sign that Firefox is grumpy right now – before, when I’ve quit Firefox and restarted it, that’s gone away. But no performance issues. (That isn’t happening in Safari – I didn’t try hundreds of turns there.)

Of course Annoyotron is a tiny game (assuming that Ben Parrish didn’t actually implement the corridor as a hundred separate rooms). Don’t know if that makes a difference.

You can check your memory usage with “Activity Monitor”. As most of the code is run at the beginning we would expect memory from JIT code to increase roughly logarithmically. So if the memory usage increases linearly that would indicate some other kind of memory leak.

That’s what I was saying, though. I’d expect memory to increase logarithmically if you begin your session by restoring to the middle of the game. (That is, memory use will spike up at the start of the session, but then mostly flatten out towards horizontal.)

If you start from the beginning of the game, memory use should spike up but then settle to an upward curve proportional to your progress through the game. (Which is a handwavy measure, because every game brings code into play at a different rate, but I believe it describes what you’re experiencing.)

When I see this it means that I’m using an older CSS stylesheet for the game page. But that isn’t a sporadic problem, obviously, so I’m not sure what you’re seeing.

Blah, now the game isn’t loading at all on either browser. This is probably just some flaky thing that is happening with my computer. If I can get it to run later I’ll check back on the Activity Monitor readings.

EDIT: OK, it’s baaaack. So: Opening Safari on apple.com/startpage: Real memory usage of about 50 MB.
After game loads in Quixe: ~97.5 MB.
…oh hey,

You can die on the second turn.

Restarting and going ten turns in: 151.25 MB.
Twenty turns in: 166.26 MB. I think the usage has been creeping up every turn; as I enter the command it burps up and drops back down.
…ok, doing a couple things in that room didn’t increase the resting memory usage. Going to a new room seemed to increase it by about .05. Handling a new object seemed to increase it to 170.63.
Twenty-nine turns in: 175.49 MB. Doing something with a new object appears to increase it a couple megs. No performance problems yet.
Restoring my save file: It goes to 198.88 MB. No performance problems (as before).
Looking: No problems; stays at 198 MB (peaking at 210 or so).
Taking an object: The usage drops into the 180s and I get an unresponsive script error. After this resolves it’s at 192.93 MB.
A couple turns later (turn 244 of the restored game, FWIW): Three unresponsive script errors for one command, usage hovering around 195 MB throughout.

Hope that’s somehow helpful. Memory usage seems to climb as I play during the early part of the game, but doesn’t seem to be spiking when I’m getting the errors. Is it possible that the memory settings on the browser are causing the problem? Did that question even make any sense?

It’s helpful, but I don’t know what it means yet.

I don’t know much about Firefox’s memory settings. They’re probably not the specific problem, however, since Safari is just as bad for you.

When the memory usage dropped (on an interpreter freeze), that’s probably a garbage-collection event in the Javascript interpreter. There may be places where I can re-use Javascript objects instead of discarding them and creating new ones. But I’ll have to dig around with a debugger to see what’s really going on.

Sorry, that was in Safari. I have enough other stuff open in Firefox (and my memory usage in Firefox is ridiculously awful enough) that data from it won’t be too useful right now.

It also may well be something weird in my computer, which occasionally does weird things. Since no one else seems to have reported it, I wouldn’t worry about this too much.

Thanks for all your work on this, anyway.

Matt