-
Notifications
You must be signed in to change notification settings - Fork 126
perf(l1): remove duplicate checks in static_left_pad
#5303
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
base: main
Are you sure you want to change the base?
Conversation
static_left_padstatic_left_pad
static_left_padstatic_left_pad
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.
Pull Request Overview
This PR optimizes the static_left_pad function used for encoding bytecode metadata by eliminating redundant bounds checking operations.
Key Changes:
- Replaces explicit length check +
saturating_sub+get_mut().ok_or()with a singlechecked_suboperation - Removes redundant bounds check by using direct indexing instead of
get_mut()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lines of code reportTotal lines added: Detailed view |
Benchmark Block Execution Results Comparison Against Main
|
Motivation
static_left_padappears in some flamegraphs, due to being used to encode bytecode metadata. This PR improves a bit the implementation.Description
This PR removes some duplicate checks from the implementation, which might improve performance.