Skip to content

Commit

Permalink
Merge pull request #653 from CeladonSS13/upstream-pr-3053
Browse files Browse the repository at this point in the history
[MIRROR] Ports a super small TG signal optimization
  • Loading branch information
MrCat15352 authored Jun 2, 2024
2 parents 9d739df + afab80f commit 6d44aaa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/datums/components/_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,12 @@
// all the objects that are receiving the signal get the signal this final time.
// AKA: No you can't cancel the signal reception of another object by doing an unregister in the same signal.
var/list/queued_calls = list()
for(var/datum/listening_datum as anything in target)
queued_calls[listening_datum] = listening_datum.signal_procs[src][sigtype]
for(var/datum/listening_datum as anything in queued_calls)
. |= call(listening_datum, queued_calls[listening_datum])(arglist(arguments))
// This should be faster than doing `var/datum/listening_datum as anything in target` as it does not implicitly copy the list
for(var/i in 1 to length(target))
var/datum/listening_datum = target[i]
queued_calls.Add(listening_datum, listening_datum.signal_procs[src][sigtype])
for(var/i in 1 to length(queued_calls) step 2)
. |= call(queued_calls[i], queued_calls[i + 1])(arglist(arguments))

// The type arg is casted so initial works, you shouldn't be passing a real instance into this
/**
Expand Down

0 comments on commit 6d44aaa

Please sign in to comment.