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

event queue optimizations #144

Closed
tehn opened this issue Feb 22, 2018 · 1 comment
Closed

event queue optimizations #144

tehn opened this issue Feb 22, 2018 · 1 comment

Comments

@tehn
Copy link
Member

@tehn tehn commented Feb 22, 2018

notes from @catfact extracted from readme

  • there is really too much allocation and mutexing going on in the event queue.
  • allocation : posting an event invokes calloc to get an event_data union. since it is a union, its a good candidate for object-pool model.
    - threads : each read and write to the event queue is protected by a mutex. it is probably not a big deal, but would be better to have at least lock-free reads. (not sure how possible this really is)
@catfact
Copy link
Collaborator

@catfact catfact commented Nov 4, 2018

coming back to this after doing some related work with lockfree SPSC queues, i don't think they are a good fit for this situation - they will tend to increase contention. since we don't have hard realtime deadlines, the mutexes are fine and should have insignificant overhead when contention doesn't happen.

the problem of course is when contention does happen - this would be when a script is doing some blocking operation during an event handler. and that just shouldn't be allowed to happen (see issue #461)


however, the allocation when posting events really is bad! events should use an object pool.

@tehn tehn closed this Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants