Closed kpreid closed 3 months ago
As of 7b9d68bd5e1c00838de3fb2c3b755d34817b40da:
Notifier
& Listener
process batches, and the new type Buffer
allows creating batches.Space
uses Buffer
to batch notifications resulting from a set()
, fill()
, or transaction commit.
Right now, each individual change to a
Space
or other entity usinglisten::Notifier
immediately iterates through the set of listeners and invokes all of them. This is probably rather cache-unfriendly and also contains redundant operations.Try buffering notifications until the end of the overall operation (e.g. a transaction). Benchmark the results (e.g. modifying a
Space
with a listening raytracer). The buffer could be stored in the notifier itself, or it could be in a guard object which flushes the buffer on drop.On the
Listener
side, change the signature to accept a slice of messages.