Skip to content

Fix performance regression of x86_64 GCM with rustc 1.87 - #90

Merged
ctz merged 2 commits into
mainfrom
jbp-x86-gcm-perf-intrinsics
Jun 1, 2025
Merged

Fix performance regression of x86_64 GCM with rustc 1.87#90
ctz merged 2 commits into
mainfrom
jbp-x86-gcm-perf-intrinsics

Conversation

@ctz

@ctz ctz commented Jun 1, 2025

Copy link
Copy Markdown
Owner

rustc 1.87 recently broke inlining of intrinsics where the caller has the proper target_features, but the callee does not. See rust-lang/rust#139029, rust-lang/rust#141309, etc. That looks like (1.86 -> 1.87, main):

aes256-gcm/graviola/8KB time:   [2.2043 µs 2.2170 µs 2.2327 µs]
                        thrpt:  [3.4172 GiB/s 3.4413 GiB/s 3.4612 GiB/s]
                 change:
                        time:   [+44.446% +47.398% +50.394%] (p = 0.00 < 0.05)
                        thrpt:  [-33.508% -32.156% -30.770%]
                        Performance has regressed.

Which is extremely grim. This PR avoids relying on the previous behaviour, and restores performance with 1.87 (main -> this pr):

aes256-gcm/graviola/8KB time:   [1.4685 µs 1.4710 µs 1.4743 µs]
                        thrpt:  [5.1750 GiB/s 5.1866 GiB/s 5.1955 GiB/s]
                 change:
                        time:   [-34.562% -33.443% -32.217%] (p = 0.00 < 0.05)
                        thrpt:  [+47.531% +50.246% +52.818%]
                        Performance has improved.

@codecov

codecov Bot commented Jun 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.31%. Comparing base (08b80ea) to head (9f271e6).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
- Coverage   99.31%   99.31%   -0.01%     
==========================================
  Files         168      168              
  Lines       40269    40265       -4     
==========================================
- Hits        39994    39990       -4     
  Misses        275      275              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq

codspeed-hq Bot commented Jun 1, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #90 will improve performances by 10.96%

Comparing jbp-x86-gcm-perf-intrinsics (9f271e6) with main (08b80ea)

Summary

⚡ 2 improvements
✅ 132 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
graviola[8KB] 20.6 µs 18.6 µs +10.96%
graviola[8KB] 21.5 µs 19.4 µs +10.64%

@ctz
ctz merged commit 397ecf7 into main Jun 1, 2025
@ctz
ctz deleted the jbp-x86-gcm-perf-intrinsics branch June 1, 2025 16:40
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.

1 participant