-
Notifications
You must be signed in to change notification settings - Fork 132
perf(l1): avoid copy when reading account code #5289
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 Block Execution Results Comparison Against Main
|
| let Some(bytes) = self | ||
| .db | ||
| .get_pinned_cf(&cf, code_hash.as_bytes()) | ||
| .map_err(|e| StoreError::Custom(format!("RocksDB read error: {}", e)))? |
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.
Nit: is there no StoreError::ReadError or similar already?
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.
There is a ReadError but it's error message is "Could not open DB for reading" which implies a different kind of error, and doesn't pass-through the message.
**Motivation** Currently we use `get_cf` for reading codes, which internally calls `get_pinned_cf` and copies the result. This copying takes up 6% of code reading time. **Description** Since data needs to be deserialized first, we could use a borrowed value and avoid this copy by calling `get_pinned_cf` directly.
Motivation
Currently we use
get_cffor reading codes, which internally callsget_pinned_cfand copies the result. This copying takes up 6% of code reading time.Description
Since data needs to be deserialized first, we could use a borrowed value and avoid this copy by calling
get_pinned_cfdirectly.