* More timer debugging for the debug gods.
* Its times like this I wish I could amend commit from the web interface
* git commit -a -amend&&git push --force
The list of active timers timer_id_dict identifies timers by their numerical id as a string. However this was done using embedded expressions inside the string, which calls num2text with a default of 6 significant figures. This means anything at or above 1 million is expressed in scientific notation.
"timer[1000000]" -> "timer1e+06"
"timer[1000001]" -> "timer1e+06"
Calling num2text manually with 8 significant figures kicks the collision problem down the road to 2^24 (16 million).
nextid is now selectively incremented and is looped back to 1 when reaching the 2^24 threshold.
Also now includes collision checking.
* Makes qdeleted and qdestroying macros
* Makes QDELETED and QDESTROYING uppercase
* Swap qdel checks istype's for != null's
* Fix it
* How was this missed?
* Fixes freon causing lag
Yes, these were stacking. so a turf would have a bunch of "handle wet" timers running on it, every 1.5 seconds, all checking the same shit.
* Fixes unique timers
Making timers run thru qdel will be a cost a pretty fair chunk of resources, and will very likely flood the qdel controller, but it should do for now until i figure out why they randomly decide to stop qdeling.
Also, changes the only thing i think could be an issue causing references to not get cleaned up to be less lean and more forgiving.
I'll revisit this at some point and see if i can't figure this out.
* Fixes timers being left around, Makes addtimer() sanic fast.
This adds a new flag, TIMER_STOPPABLE. Most(80%) of the overhead for addtimer() was in adding the timer to the associated lookup list for deltimer() to use. Moving that functionality to a flag so it wouldn't slow down the 70% of things calling timers puts the final nail in the coffin of byond's sleep/spawn().
spawn: 324 seconds across 5,948,372 calls
addtimer: 67 seconds across 5,953,220 calls
The testing setup for profiling was included in this commit, it will be removed in a later commit. @Fox-McCloud
* Remove profiling procs.
* fix runtime
luckly when this happened, we were about to resume anyways.
hashlist was designed to ensure that timers on different objects with the same name didn't get detected as the same timer, but when I added it, i forgot to make this line actually use the hashlist.
Basically, they key difference between StonedMC and CarnMC is that when multiple ticks want to run at the same byond tick, we divvy up the tick between the subsystems, rather then allow one subsystem to hog it all.
The key difference between StonedMC and GoonPS is that we allow the subsystems to tell us how to divvy up the tick using flags and priority.
The new SS_ flags allows us to select behaviors that used to be piggybacked as side effects of dynamic wait or default but sometimes unneeded behavior.
Dynamic wait is 100% gone, lower priority and SS_BACKGROUND are better more refined ways of doing this when combined with MC_TICK_CHECK
I have by design never looked at the inners of goonPS, so this is all original code but I know it uses two loops because of comments by goon devs on reddit threads, that design didn't make sense before, but when I can tell a SS how much of a byond tick it is allowed to have, knowing how many need to run this tick is helpful I also know a bit more about how it works from piecing together comments in #vgstation.
Detailed list of changes:
Subsystems now have flags, allowing fine grain control over things like rather or not it processes, inits, rather it's wait is how long between runs (post run timing) or how long between starts, and rather or not late fires should cause the next fire to be earlier.
Mc now has two loops One loop handles queuing shit, one loop handles running shit.
MC now splits up tick allotment rather than first come first serve Subsystems can even request a bigger share using higher priorities. (It will even resume subsystems it paused if other subsystems hadn't used as much as it predicted they might need)
Default fps is now 20 This is related enough to the MC and it's a change that's really long since over due
All code oddities are most likely to be necessities to lower overhead on the mc since it runs every tick
spawns have a high overhead.
I only went for easy targets, almost every spawn could be removed with a few subsystems in place to handle delays or cooldowns
It still works because... luck? The only thing that uses this is the
Crew Monitor which sends a Z-level as the argument... Which happens to
work because the Z-level is usually 1.