Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batched notifications #457

Closed
kpreid opened this issue Jan 29, 2024 · 1 comment
Closed

Batched notifications #457

kpreid opened this issue Jan 29, 2024 · 1 comment
Labels
area: data Things related to the data structures underlying the world, and the functions that manipulate them. kind: performance Ways to increase performance or efficiency without adding functionality

Comments

@kpreid
Copy link
Owner

kpreid commented Jan 29, 2024

Right now, each individual change to a Space or other entity using listen::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.

@kpreid kpreid added kind: performance Ways to increase performance or efficiency without adding functionality area: data Things related to the data structures underlying the world, and the functions that manipulate them. labels Jan 29, 2024
@kpreid
Copy link
Owner Author

kpreid commented Mar 6, 2024

As of 7b9d68b:

  • 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.

@kpreid kpreid closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: data Things related to the data structures underlying the world, and the functions that manipulate them. kind: performance Ways to increase performance or efficiency without adding functionality
Projects
None yet
Development

No branches or pull requests

1 participant