mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-25 09:01:40 +00:00
* Life() Optimization Part 1: Organ order It turns out organ code is really quite dumb. Wastes a lot of time. I'm going to be doing what I can to optimize it in this branch. To start with: If we can ensure organs are sorted according to organ_process_order inside internal_organs_slot We can do away with a needless get_organ_slot call in handle_organs, and avoid needing to iterate over 30 entries, one per possible organ slot, instead iterating just the ones we have This saves roughly 5% of life * Organ Optimization Part 2: base on_life() Organ on_life, despite not looking it, is a remarkably hot proc. Called something close to 9 times for each human on the map, it's worth taking care to clean it up. As things currently stand, we do two dumb things. The first is manually checking for organ failure each iteration. We do this because we allow organ damage to be modified outside of the applyOrganDamage proc, which also calls check_failing_thresholds. There's no reason to do this, so I've gone through and removed all instances of it The second is calling applyOrganDamage no matter what, to "heal" the organ. Even if it isn't damaged. The fix for this is simple, just an if check. This saves roughly 10% of pre changes Life() cost * Blood cleanup beta version Blood code is slightly more sane, but it calls get_part_bleed_rate a lot, and does other checks that are the same so long as the bleed rate never changes. This is reasonably expensive So, I'm going to make it event driven, and cache the bleed rate. But to do that, I need to be able to react to limb ownership changes, and well, there's a few that don't use the existing setter. This commit fixes that * Blood cleanup beta 2.0 I'm starting on the work to make bleed rate cached Adds NO_BLEED to the signal registration of set_owner This lets us generically react to it Makes changing your bleedstacks into a proc we can hook into Fully implements it * Blood optimization beta 3.0 Hooks into embedding/embed details updating, this ensures the embed aspect of bleed rate is properly accounted for * Blood optimization beta 4.0 Hooks wounds into refresh_bleed_rate, adds a setter for blood flow to support this I feel like there are places where this would be useful, but I'm not totally sure Kinda wanted to ask ryll * Blood optimization, the final countdown Fully caches bleed_rate. Because I can do this, we only need to call update_part_wound_overlay when bleed rate updates This saves 15%! of human life tick. Get owned * Optimizes body_temperature_alerts It turns out that clearing alerts and sending signals every process is wasteful. There's no reason to do it unless last process was a problem one The change for that is quite easy, literally just a new var on human. Saves 2% of human life tick. Very nice for the amount of time I put into it BTW, I have a feeling that most of the overhead of bodytemp is caused by human body temperature being higher then room temperature. Not sure what to do about this though * Does something similar to disgust Basically, don't continusly send signals if you have no disgust It's rare enough that this is all the caching we really need to do Saves roughly 1% of life tick. Right on the edge of not worth it * Some cleanup to how mob fires handle their lighting, adds a check to liver coder * Cleans up update_gravity slightly It's very close to outside a measurable deviation faster, but I honestly just did it to make it easier to read * Fuck you * Very minor organ optimization Instead of using internal_organs_slot for our organ iteration, we use it to produce a sorted internal_organs list. This is barely worth it, ends up being 0.7% of life saved. I only did it because it makes a semi noticable impact on our current numbers. * Revert "Very minor organ optimization" It turns out mutating internal_organs is important sometimes The usefulness of this change is small enough that I don't want to spend more time on it So back it goes into the dirt This reverts commit 622bd34adb8d8a3d5f2763ac659446ef3362e3cd. * Properly returns false in IgniteMob * Adds a parent call to setBleedStacks I like it, it's a good idea
13 KiB
13 KiB