Repository navigation
crypto: Refactor RIPEMD-160 functions for inlining - #1800
Conversation
Merging this PR will improve performance by 94.81%
Performance Changes
Tip Curious why performance improved? Comment Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1800 +/- ##
==========================================
- Coverage 98.24% 98.24% -0.01%
==========================================
Files 186 186
Lines 17176 17175 -1
Branches 3921 3922 +1
==========================================
- Hits 16874 16873 -1
Misses 233 233
Partials 69 69
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Force inlining of the helper functions in RIPEMD-160 implementation. The implementation is constructed around inline steps functions, make sure these are always inlined. This actually shortens the code. Additionally, GCC was not able to inline boolean functions behind array of function pointers. Now function specialization is used. Co-authored-by: Paweł Bylica <pawel.bylica@erigon.tech>
9b4f0ff to
10a3255
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the RIPEMD-160 helper-inlining refactor.
No open issues 🎉
What changed in this PR
Refactors RIPEMD-160 helpers to improve compiler inlining, addressing GCC’s difficulty inlining calls through function-pointer arrays while preserving the hash calculations.
Changes:
- Replaces the Boolean function-pointer array with round-indexed template specializations.
- Adds
always_inlineattributes to Boolean helpers and step functions.
| File | Description |
|---|---|
lib/evmone_precompiles/ripemd160.cpp |
Uses specialized Boolean helpers and forces helper inlining in RIPEMD-160 steps. |
Review effort: Balanced
Force inlining of the helper functions in RIPEMD-160 implementation. The implementation is constructed around inline steps functions, make sure these are always inlined. This actually shortens the code. Additionally, GCC was not able to inline boolean functions behind array of function pointers. Now function specialization is used.
Upstreamed from erigontech@56dd838.
Co-authored-by: Paweł Bylica pawel.bylica@erigon.tech
Instructions per hash of 1024 bytes (x86-64-v2,
-O3):