Skip to content

Add inlining hints to concurrent hash map #2394

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

krenzland
Copy link
Contributor

This PR adds inlining hints to several functions of the ConcurrentHashMap. With clang17 and NVIDIA Grace, this speeds up the benchmarks for begin() by ~35-40% and find() by ~15-20%. The iterate benchmarks show inconclusive results and may have a slowdown or speedup depending on input size and number of threads. Overall the effect is positive.

This PR depends on #2393, otherwise the additional inlining hints will allow the compiler to remove parts of the benchmark.

@facebook-github-bot
Copy link
Contributor

@YifanYuan3 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@YifanYuan3
Copy link
Contributor

hey @krenzland, we have some internal discussion about this. Force inlining makes benchmarks faster, but makes binaries bigger and therefore slower in the wild. Some of the force inlining, for functions that are simple forwarding functions, makes sense, but we imagine that those are already inlined by the compiler.

We will have to find some real prod services to test and evaluate it, where concurrent hash map pop up as a hot function/bottleneck. Let's keep this PR pending and we will let you know when we figure out the next step. Thanks!

@krenzland
Copy link
Contributor Author

Makes sense. The functions that are force inlined here should be pretty minimal. I would guess that you'd see some real-world performance gains mostly from the find function.

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.

3 participants