ID:2936044
 
BYOND Version:515
Operating System:Windows 11 Pro 64-bit
Web Browser:Firefox 127.0
Applies to:Dream Daemon
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Checking
if(x in something.vars)
is incredibly slow under 515.1637 compared to 514.1589

This is the same proc (see code snippet) under 514.1589:

And 515.1637:




Numbered Steps to Reproduce Problem:
1. Benchmark
if(variable in something.vars)
under 514.1589
2. Benchmark
if(variable in something.vars)
under 515.1637
3. Observe that 515.1637 takes 8x longer

Code Snippet (if applicable) to Reproduce Problem:
https://github.com/sojourn-13/sojourn-station/blob/ 01e70d053489efbbfce481f85b05dfcc4ab398ab/code/modules/ projectiles/gun_firemode.dm

/datum/firemode/proc/apply_to(obj/item/gun/_gun)
// ...
for(var/propname in settings)
if(propname in gun.vars)
gun.vars[propname] = settings[propname]


Expected Results:
Checking x in vars would be of similar speed

Actual Results:
Checking x in vars is 8x slower

Does the problem occur:
Every time? Or how often? Always
In other games? Presumably
In other user accounts? Didn't test
On other computers? Yes

When does the problem NOT occur?
It always occurs on the given BYOND versions

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
514.1589 - Have not tested any versions between 514.1589 and 515.1637

Workarounds:
/datum/firemode/proc/apply_to(obj/item/gun/_gun)
for(var/propname in settings)
try
gun.vars[propname] = settings[propname]
catch
// ignore error
I'm going to need a test case for this one, because this is a very weird situation and I'm guessing the complexity of the vars in SS13 play a part in this.

The code governing "in vars" hasn't changed between 514 and 515, so some other factor has to be in play.
Substantially more time is spent on the exact same test in 515 vs 514 in this benchmark.



https://drive.google.com/file/d/ 1zIX-Pk-3m3BdhqMZujngmBiwOAKX2Ld5/view?usp=sharing