-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Trivial fns allowing control if a type is trivially encoded/decoded #7501
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: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #7501 will degrade performances by 13.21%Comparing Summary
Benchmarks breakdown
|
02e1c5c to
182bf4a
Compare
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 is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on December 7
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
|
-13.24% compile time regression is a bit unfortunate. Any way we can get this number down a bit? |
Description
Continuation of #7488.
This PR introduces the option for each type to control its own
is_trivial.Primitive data types have direct implementation (only decoding bool is false, as we need to guarantee its value is zero or one).
Structs, tuples, arrays etc... are trivial if their runtime representation and "inner types" allow for trivial encoding or decoding.
Enums are more complicated as we need to control that the enum tag is valid; they are not trivial.
String arrays are not trivially encoded/decoded for backwards compatibility with "encoding v0" that needs padding in some cases.
Some tests are showing a small regression (6 gas), which comes from the introduced "if" not being optimised away. I want to solve this in another PR, where the "if" condition will come from a const, and IR generation will guarantee that only one branch will ever be emitted.
Checklist
Breaking*orNew Featurelabels where relevant.Note
Add per-type trivial encode/decode flags and use raw_ptr fast paths in ABI (encode/decode) with supporting changes to codec, String/Vec, and tests.
AbiEncode::is_encode_trivialandAbiDecode::is_decode_trivial; add helpersis_encode_trivial/is_decode_trivial.encode/abi_decodeto branch on triviality; adddecode_from_raw_ptrand raw-ptr-baseddecode_*helpers.BufferReaderparameter accessors returnraw_ptr; minor refactors to use raw ptr copies.str[strN]non-trivial, enums non-trivial.Written by Cursor Bugbot for commit dddd944. This will update automatically on new commits. Configure here.