A TADS3/adv3 module for doing before/after testing of savefile sizes

I’ve been doing a bunch of work on dynamic procgen maps in T3. This led me to doing a bunch of before/after tests of savefile sizes to make sure nothing silly was happening (like failing to deref/garbage collect game objects that aren’t needed after a map re-roll).

The inevitable side effect of this was of course a new module: memTest github repo.

Basic usage is simple: first, create a reference save to use as the “before” size:

         // Return value is true on success, nil on failure
         memTest.referenceSave();

Then at any later point if you want to see how much the savefile has grown by, use:

         // Outputs a summary of the size difference
         memTest.report();

Or you can get the file size difference in bytes by calling:

         // Outputs the file size difference in bytes
         memTest.getDifference();

By default report() and getDifference() create a new save when they’re called and compare its size to the reference save’s. You can suppress this behavior by calling these methods with boolean true as their only argument. If you do that, then you have to manually create test saves via memTest.testSave() before using report(true) or getDifference(true).

As a side note, one of the things that the module takes care of is making sure that any game it’s compiled into a) has a player character, b) has at least one room, and c) that the player character’s location is not nil. Which, as it turns out, are actually requirements for creating a save state.

4 Likes

At this point I’m imagining you being like the shopkeeper character in a game where after a quest, the player shows up to see what new modules are available.

6 Likes

“Stay awhile and listen…for some suitably broad definition of ‘awhile’ and where ‘listen’ is a stochastic process satisfying the following…”

3 Likes