-
Notifications
You must be signed in to change notification settings - Fork 118
perf(l1): use asm ffi keccak #5247
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 for c5c879eClick to view benchmark
|
Benchmark for 5ffb6bdClick to view benchmark
|
Benchmark for a6f1fadClick to view benchmark
|
| impl Default for Keccak256 { | ||
| fn default() -> Self { | ||
| Self { | ||
| state: State::default(), | ||
| tail_buf: [0; BLOCK_SIZE], | ||
| tail_len: 0, | ||
| } | ||
| } | ||
| } |
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.
This can be derived in the declaration of the struct. All the fields are taking their default value.
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.
Rust let go of our hands. It can't be done because arrays only implement default up to a certain number less than 136.
crates/common/crypto/keccak/mod.rs
Outdated
| Self { | ||
| state: State::default(), | ||
| tail_buf: [0; BLOCK_SIZE], | ||
| tail_len: 0, | ||
| } |
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.
you can call default() here.
Benchmark for a22c1faClick to view benchmark
|
Benchmark for 21eb90eClick to view benchmark
|
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
| // Hash value for an empty trie, equal to keccak(RLP_NULL) | ||
| pub static ref EMPTY_TRIE_HASH: H256 = H256::from_slice( | ||
| &Keccak256::digest([RLP_NULL]), | ||
| pub static ref EMPTY_TRIE_HASH: H256 = H256( | ||
| keccak_hash([RLP_NULL]), | ||
| ); | ||
| } |
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.
we should refactorize the use of this lazy_static! and use std LazyLock/LazyCell.
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.
I will file an issue with this task.
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.
We should move the EMPTY_KECCACK_HASH constant to this module too. (and fix that horrible typo too)
| @@ -0,0 +1,855 @@ | |||
| // Modified: | |||
| // - Ran `cpp` to substitute constants. | |||
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.
We should paste the full command here.
Benchmark for b2647ebClick to view benchmark
|
Replace sha3 keccak to an assembly version using ffi