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

Eliminate overhead of std::function in EventPoller #12

Closed
andrewkcorcoran opened this issue Sep 16, 2020 · 4 comments · Fixed by #13
Closed

Eliminate overhead of std::function in EventPoller #12

andrewkcorcoran opened this issue Sep 16, 2020 · 4 comments · Fixed by #13

Comments

@andrewkcorcoran
Copy link

https://github.com/Abc-Arbitrage/Disruptor-cpp/blob/master/Disruptor/EventPoller.h#L39 could be trivially refactored to take a forwarding reference as the eventHandler instead of a std::function. This would eliminate the potential for memory allocation when the std::function is constructed and the virtual call when the eventHandler is invoked.

@oktal
Copy link
Member

oktal commented Sep 16, 2020

Hello,

You are right, the eventHandler is not stored anywhere so we do not need a std::function there.

Do you want to submit a Pull Request ?

@andrewkcorcoran
Copy link
Author

As it's such a simple change, if there's someone else who can submit the PR it would be a lot faster than waiting on me as the internal process I have to follow for external code contributions can take a while.

@slumber
Copy link
Contributor

slumber commented Sep 16, 2020

I can do this if you don't mind. @andrewkcorcoran

@andrewkcorcoran
Copy link
Author

andrewkcorcoran commented Sep 16, 2020 via email

ybainier added a commit that referenced this issue Sep 18, 2020
EventPoller: eliminate std::function in poll() arguments
rosebible pushed a commit to rosebible/Disruptor-cpp that referenced this issue Mar 10, 2021
rosebible pushed a commit to rosebible/Disruptor-cpp that referenced this issue Mar 10, 2021
rosebible pushed a commit to rosebible/Disruptor-cpp that referenced this issue Mar 10, 2021
…egh-12-event-poller

EventPoller: eliminate std::function in poll() arguments
jsrdzhk pushed a commit to jsrdzhk/Disruptor-cpp that referenced this issue Oct 19, 2023
jsrdzhk pushed a commit to jsrdzhk/Disruptor-cpp that referenced this issue Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants