-
Notifications
You must be signed in to change notification settings - Fork 131
perf(levm): use unchecked swap #5439
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
Conversation
Lines of code reportTotal lines added: Detailed view |
Benchmark Results ComparisonNo significant difference was registered for any benchmark run. Detailed ResultsBenchmark Results: BubbleSort
Benchmark Results: ERC20Approval
Benchmark Results: ERC20Mint
Benchmark Results: ERC20Transfer
Benchmark Results: Factorial
Benchmark Results: FactorialRecursive
Benchmark Results: Fibonacci
Benchmark Results: FibonacciRecursive
Benchmark Results: ManyHashes
Benchmark Results: MstoreBench
Benchmark Results: Push
Benchmark Results: SstoreBench_no_opt
|
Benchmark Block Execution Results Comparison Against Main
|
|
Assembly code for SWAP: BasePR |
|
The noteworthy difference being the absence of |
|
|
||
| ### 2025-11-27 | ||
|
|
||
| - Use unchecked swap for stack [#5439](https://github.com/lambdaclass/ethrex/pull/5439) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entry is misleading, as this no longer uses unchecked swap but a hint for the compiler.
| unsafe { | ||
| assert_unchecked(self.offset < STACK_LIMIT) | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a comment explaining that this removes a bound check in the call to swap.
Motivation
Currently we check the validity of the swap for the purpose of returning EVM errors, but swap itself contains bounds checks too.
Description
Uses unsafe code to perform the swap.