-
Notifications
You must be signed in to change notification settings - Fork 6
perf: skipping computing compression ratio for l1 messages #345
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: scroll
Are you sure you want to change the base?
Conversation
// Note: We compute the transaction ratio on tx.data, not on the full encoded transaction. | ||
let compression_ratio = compute_compression_ratio(base.input()); | ||
Self::new(base, encoded, Some(compression_ratio)) | ||
let compression_ratio = |
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.
then_some
is eagerly evaluated. Better to use then
to avoid the computation altogether for L1 messages. (Or just a simple if
expression.)
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.
nice catch!
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 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.
encoded is ok, since it's just a reference to a var, it's fine to evaluate it eagerly.
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.
update with FnOnce and should be good!
// Note: We compute the transaction ratio on tx.data, not on the full encoded transaction. | ||
let compression_ratio = compute_compression_ratio(base.input()); | ||
Self::new(base, encoded, Some(compression_ratio)) | ||
let compression_ratio = (!tx.is_l1_message()).then(compute_compression_ratio(base.input())); |
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.
then
takes a FnOnce
, you need to add ||
// Note: We compute the transaction ratio on tx.data, not on the full encoded transaction. | ||
let compression_ratio = compute_compression_ratio(base.input()); | ||
Self::new(base, encoded, Some(compression_ratio)) | ||
let compression_ratio = (!tx.is_l1_message()).then(compute_compression_ratio(base.input())); |
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.
same
CodSpeed Performance ReportMerging #345 will not alter performanceComparing Summary
|
As per the Issue #344, Computing compression ratio is skipped for L1 messages.