Optimize script?
Posted: Wed Aug 12, 2015 12:37 pm
I'm about to re-write a few parts of my script to optimize it, and looking around have found a few discussions about this (localize/avoid global namespace, etc).
If I have a large table (~1k entries) of the below structure: Are lookups from it going to be independent of order, alphabetical, start->finish, finish->start, etc? Just wondering if I can speed it up slightly by forcing the table to a specific order.
["a dun potion"] = " Lvl:20 vigorize critic ",
["a vial of white powder"] = " Lvl:15 blindness - poison - haste ",
["a vial of dolomite"] = " Lvl:50 stone - dispel invisible - dispel good ",
Optimization came up because I have a large sql database that I just added a function to access it. Individual selects are fast - If it has to do a thousand of them though, it lags mudlet a couple seconds - Noticable. If I keep a cache of a subset of the database (the most referenced results), and consult that cache prior to running a select against the database, I have a noticeable speed increase: From lagged a couple seconds, to realtime.
If I have a large table (~1k entries) of the below structure: Are lookups from it going to be independent of order, alphabetical, start->finish, finish->start, etc? Just wondering if I can speed it up slightly by forcing the table to a specific order.
["a dun potion"] = " Lvl:20 vigorize critic ",
["a vial of white powder"] = " Lvl:15 blindness - poison - haste ",
["a vial of dolomite"] = " Lvl:50 stone - dispel invisible - dispel good ",
Optimization came up because I have a large sql database that I just added a function to access it. Individual selects are fast - If it has to do a thousand of them though, it lags mudlet a couple seconds - Noticable. If I keep a cache of a subset of the database (the most referenced results), and consult that cache prior to running a select against the database, I have a noticeable speed increase: From lagged a couple seconds, to realtime.