-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(store): compute FieldLayout at compile time #1508
Conversation
🦋 Changeset detectedLatest commit: 9c956ca The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -32,9 +36,7 @@ struct Dynamics1Data { | |||
library Dynamics1 { | |||
/** Get the table values' field layout */ | |||
function getFieldLayout() internal pure returns (FieldLayout) { |
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.
Do we need this method anymore?
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.
seems fine for completeness (so the methods match what you can get from the Tables
table), if it's not used anywhere it's also not included in the bytecode
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 don't know why anyone would choose the less efficient one (function call) over the more efficient one though (importing the _fieldLayout
directly)
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.
amazing, thank you!!
Co-authored-by: alvarius <[email protected]>
Followup to #1336
Fixes #1327
Computing FieldLayout bytes from schema field type array is expensive (~500 + 500 * # of schema fields). This change precomputes the FieldLayout offchain inside codegen and hardcodes the byte into the auto-generated table libraries.