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

Use triomphe::Arc by default. #86

Closed
wants to merge 1 commit into from

Conversation

michaelsproul
Copy link
Contributor

Change the default Arc backend to triomphe, which results in speedups of up to 40% (per #85).

The default backend is changed to ArcTK, while retaining the ability for the user to swap out to ArcK if they prefer.

This PR does not currently include the ability to completely compile-out triomphe. If that were desired, we would have to expose a feature called triomphe which controls the backend, and causes std::sync::Arc to be used when the feature is disabled.

@michaelsproul
Copy link
Contributor Author

Some more benchmarks, this time on x86_64 Linux: https://gist.github.com/michaelsproul/4462d18ce7075479b03517349ffd06e2

Unfortunately it looks like we can't just Pareto-improve by switching to triomphe. There are some substantial regressions in some of the x86_64 benchmarks, especially for RedBlackTreeMap. I made a spreadsheet of results here: https://docs.google.com/spreadsheets/d/1WsuOhA2DoKUCfoEE-1OAFPjMMUgo4jFpiZx8RVbrpH0/edit

One strategy would be to switch the backend only where the gains are universal, i.e. for List, Queue and HashTrieMap. Vector could go either way, and RedBlackTreeMap is a hard no IMO unless we gate by target-arch (or OS). I'm not entirely sure whether it's the ARM CPU or the OS making more of a difference, as I know the macOS allocator is substantially better with fragmentation than GNU malloc. In production I tend to use jemalloc, and will try to re-run the Linux benchmarks with jemalloc to see if this makes a difference.

My benchmarking process was:

git checkout master
cargo bench -- sync # baseline
git checkout triomphe
cargo bench -- sync # comparison

If you have any different hardware @orium it might also be good to see the results from that.

@orium orium deleted the branch orium:master October 30, 2023 21:25
@orium orium closed this Oct 30, 2023
@orium
Copy link
Owner

orium commented Oct 30, 2023

@michaelsproul Sorry, I just renamed the master branch to main. Can you open the PR again after rebasing on main please?

@michaelsproul
Copy link
Contributor Author

Thanks, reopened here: #88

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 this pull request may close these issues.

2 participants