Remove resolved perf-check TODOs from UInt256 shift helpers#10406
Open
parthdagia05 wants to merge 1 commit intobesu-eth:mainfrom
Open
Remove resolved perf-check TODOs from UInt256 shift helpers#10406parthdagia05 wants to merge 1 commit intobesu-eth:mainfrom
parthdagia05 wants to merge 1 commit intobesu-eth:mainfrom
Conversation
Signed-off-by: Parth Dagia <parth.24bcs10414@sst.scaler.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Remove the two
// TODO: check perf - wiring [shiftRight|shiftLeft] callers with this onecomments aboveUInt256.sar0andUInt256.shl0, added in #10216.Why
The TODOs asked whether routing the public shift methods (
sar,shr,shl) through the new internal helpers (sar0,shl0) preserves performance versus the pre-refactor implementation inStackArithmetic. I ran the existing V2 shift JMH benchmarks before and after #10216 to find out.Method
8e4ef80c40^(commit67dbd9a4c5, parent of Move SAR, SHR and SHL to UInt256 #10216)upstream/mainat80b381ee9fSarOperationBenchmarkV2,ShlOperationBenchmarkV2,ShrOperationBenchmarkV2Results
Summary: 6 statistically significant regressions (+7%–+14%, all sub-1ns absolute) on overflow / specific fixed-shift cases, 1 statistically significant improvement (SHL
FULL_RANDOM, −14.6%), 18 within noise.Conclusion
The refactor is performance-neutral on realistic workloads (random-shift is unchanged or faster). The small overflow-path regressions are sub-nanosecond and not worth a follow-up at this absolute scale. The TODOs have been answered closing them.
A separate question worth a follow-up issue (not this PR): whether re-introducing public-method early returns for
shift >= 256would recover the OVERFLOW regression without bloating the API.Test plan
./gradlew :evm:compileJavapasses:evm:test-UInt256Test(91),UInt256PropertyBasedTest(118),Shift256OperationsTest(7),ShiftOperationsPropertyBasedTest(10),ShiftOperationsV2PropertyBasedTest(25) - 251 tests, all pass