mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-25 09:01:40 +00:00
[MIRROR] Optimize /atom/movable/Initialize with faster check for blocks_emissive [140ms on init] [MDB IGNORE] (#20293)
* Optimize /atom/movable/Initialize with faster check for blocks_emissive [140ms on init] (#74453) Quoting the comment: This one is incredible. `if (x) else { /* code */ }` is surprisingly fast, and it's faster than a switch, which is seemingly not a jump table. From what I can tell, a switch case checks every single branch individually, although sane, is slow in a hot proc like this. So, we make the most common `blocks_emissive` value, EMISSIVE_BLOCK_GENERIC, 0, getting to the fast else branch quickly. If it fails, then we can check over every value it can be (here, EMISSIVE_BLOCK_UNIQUE is the only one that matters). This saves several hundred milliseconds of init time. * Optimize /atom/movable/Initialize with faster check for blocks_emissive [140ms on init] --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Clickable stat() button.
|
||||
/obj/effect/statclick
|
||||
name = "Initializing..."
|
||||
blocks_emissive = NONE
|
||||
blocks_emissive = EMISSIVE_BLOCK_NONE
|
||||
var/target
|
||||
|
||||
INITIALIZE_IMMEDIATE(/obj/effect/statclick)
|
||||
|
||||
Reference in New Issue
Block a user