I noted from this topic that tables are less memory intensive than lists and hence probably help a program run faster.
https://intfiction.org/t/whats-the-least-memory-intensive-data-structure-in-i7/1859/1
However, I was surprised to find that tables also take up less disk space–or seem to, based on my compiling this code for release.
[code]“pgs” by Andrew Schultz
room 1 is a room.
[table of junk
mytxt
“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”
“a”
“a”
“a”]
junk is a list of text variable. junk is {“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”, “a”, “a”, “a” }
[/code]
I alternatively commented out the table and the list, and I got the following file sizes for release builds:
Z5 tables file = 243134
Z8 tables file = 248254
Gblorb tables file = 324542
Z5 list file = 290752
Z8 list file = 296382
Gblorb list file = 421822
So the main question is, I’d think the reverse is true, that a long table entry would cause inform to allot more disk space to each table row, though I don’t know much about that. Is there a simple layman’s explanation?
Also, to apply this, my lists are generally static–I shuffle them randomly at the beginning of play, then let the player randomly page through them. I never need to insert or remove elements. There are 25 lists and about 3000 random items.
Would there be reason to believe that converting these lists to tables would make the program run significantly faster? (editing the code would not be bad with perl.) And have I, thus, been using the wrong structures all this time?