I've moved some of the cached data in global to a bucket system (instead of a dictionary id --> data, it's now a nested dictionary (id % update_interval) --> [id --> data].
Since you have more modules that call on_tick, I've made a separated module Buckets that can be imported and used whenever you need it. Transitioning to it is very easy overall: instead of calling:
global.rtgs[entity.unit_number] it is instead Buckets.get(global.rtgs, entity.unit_number)
Default interval is 60 ticks (so entities are updated 1 per second instead of every tick), but can be customized per module.
Added some reallocate and migrate functions ad hoc for you if you feel to change the update interval of a module or to migrate other contents from previous table (this is also used in the migration file to migrate from .12 and earlier).
By all means, I did not run it through profilers and such, but at first glance, seems to help
(the oxygenators's fluid box had to be doubled and moved to -1 to allow the fluid box to gather the fluids for a full 1s cycle)
I've moved some of the cached data in
global
to a bucket system (instead of a dictionary id --> data, it's now a nested dictionary (id % update_interval) --> [id --> data].Since you have more modules that call
on_tick
, I've made a separated moduleBuckets
that can be imported and used whenever you need it. Transitioning to it is very easy overall: instead of calling:global.rtgs[entity.unit_number]
it is insteadBuckets.get(global.rtgs, entity.unit_number)
Default interval is 60 ticks (so entities are updated 1 per second instead of every tick), but can be customized per module.
Added some
reallocate
andmigrate
functions ad hoc for you if you feel to change the update interval of a module or to migrate other contents from previous table (this is also used in the migration file to migrate from .12 and earlier).By all means, I did not run it through profilers and such, but at first glance, seems to help
(the oxygenators's fluid box had to be doubled and moved to -1 to allow the fluid box to gather the fluids for a full 1s cycle)