mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[MIRROR] makes the SEND_SIGNAL() define use the ?[] operator, my biggest microop ever? (#8185)
* makes the SEND_SIGNAL() define use the ?[] operator to save 11 ns (#61319) if(list?[index]) is very slightly faster than if(list && list[index]) and SEND_SIGNAL() while very cheap is fucking everywhere, so i benchmarked ?[] looking at the last two (Pictures of entries not shown here), 2835487/second -> one iteration every 352.67 nanoseconds for the if(list && list[index]) and 2931099/second -> one iteration every 341.17 nanoseconds, so we saved a grand total of 11 nanoseconds for each SEND_SIGNAL() define! thats the time light in a vacuum takes to travel 3.3 meters! thats a lower one though, the third null list check saved 24 ns and theres probably a fair bit of overhead with the way im benchmarking this since each loop has to check world.timeofday but eh whatever * makes the SEND_SIGNAL() define use the ?[] operator, my biggest microop ever? Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/// The datum hosting the signal is automaticaly added as the first argument
|
||||
/// Returns a bitfield gathered from all registered procs
|
||||
/// Arguments given here are packaged in a list and given to _SendSignal
|
||||
#define SEND_SIGNAL(target, sigtype, arguments...) ( !target.comp_lookup || !target.comp_lookup[sigtype] ? NONE : target._SendSignal(sigtype, list(target, ##arguments)) )
|
||||
#define SEND_SIGNAL(target, sigtype, arguments...) ( !target.comp_lookup?[sigtype] ? NONE : target._SendSignal(sigtype, list(target, ##arguments)) )
|
||||
|
||||
#define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( SEND_SIGNAL(SSdcs, sigtype, ##arguments) )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user