Skip to content

[ML] Threading optimisations #433

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

Merged
merged 3 commits into from
Mar 7, 2019
Merged

Conversation

tveasey
Copy link
Contributor

@tveasey tveasey commented Mar 5, 2019

Wrapping function calls in a std::packaged_task was slightly more than doubling the runtime overhead per task in the thread pool. This moves to using a standard function pointer which can (optionally) hold the promise to which results are written. A nice side effect is we don't actually need a custom wrapper around std::future to unpack the result of function passed to the thread pool, so the code is slightly cleaner.


return std::move(result);
return std::move(result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indenting looks a bit off here and in the 4 lines above - is what clang-format decided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I've seen this before when using brace initialiser with a lambda. I'll rejig and see if it improves the formatting.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tveasey tveasey merged commit c63e47a into elastic:master Mar 7, 2019
tveasey added a commit to tveasey/ml-cpp-1 that referenced this pull request Mar 7, 2019
tveasey added a commit that referenced this pull request Mar 8, 2019
@tveasey tveasey deleted the thread-pool-speedups branch March 22, 2019 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants