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

feat: find_entry simd optimization #179

Closed
wants to merge 1 commit into from

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Feb 4, 2023

This PR tries to address #171 by using std::simd on nightly rust.

My local stress test results:
RUSTFLAGS="-Ctarget-feature=+avx2" cargo +nightly run -p parity-db-admin --release -- stress

sse2
Completed 100000 commits in 70.011662619 seconds. 1428.3334555871788 cps. 0 hits, 0 misses, 0 iterations, 0 qps
Completed 10000000 queries in 6.168205102 seconds. 1621217.1668477051 qps

base
Completed 100000 commits in 62.011042791 seconds. 1612.616003524352 cps. 0 hits, 0 misses, 0 iterations, 0 qps
Completed 10000000 queries in 5.826384161 seconds. 1716330.3557868504 qps

base_simd 2 lanes
Completed 100000 commits in 66.00952211 seconds. 1514.9329491184221 cps. 0 hits, 0 misses, 0 iterations, 0 qps
Completed 10000000 queries in 5.915917492 seconds. 1690354.8796146733 qps

base_simd 4 lanes
Completed 100000 commits in 63.01187526 seconds. 1587.0024433867327 cps. 0 hits, 0 misses, 0 iterations, 0 qps
Completed 10000000 queries in 5.814712547 seconds. 1719775.4694098036 qps

@arkpar
Copy link
Member

arkpar commented Feb 6, 2023

Thank you, but I'm afraid we can't accept it. This library is mainly used in the stable rustc environment. Also, maintenance costs and extra dependencies are just not worth the marginal difference in query performance.
I've also added some benchmarks in #180. Even though the function itself is twice as fast, the query performance (qps) is only 3-5% better when measured in the stress test.

sse2
Completed 100000 commits in 70.011662619 seconds. 1428.3334555871788 cps. 0 hits, 0 misses, 0 iterations, 0 qps
Completed 10000000 queries in 6.168205102 seconds. 1621217.1668477051 qps

base
Completed 100000 commits in 62.011042791 seconds. 1612.616003524352 cps. 0 hits, 0 misses, 0 iterations, 0 qps
Completed 10000000 queries in 5.826384161 seconds. 1716330.3557868504 qps

On my machine sse2 was a bit faster than base when averaged over 5 runs each.

@arkpar arkpar closed this Feb 6, 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 this pull request may close these issues.

None yet

2 participants