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
Make wrapped lists in PbList monomorphic #902
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use the same allocation syntax in all allocation sites to make sure one implementation class will flow into the fields. For `PbMap`, this doesn't make any difference, but makes the intention clear. Map calls are currently already monomorphic. For `PbList`, the list field becomes monomorphic growable list (from the list base class). This makes `add` calls monomorphic and inlinable, and avoids double mutability checks (once in `PbList.add`, again in `_wrappedList.add`).
mkustermann
approved these changes
Nov 20, 2023
mkustermann
approved these changes
Nov 20, 2023
osa1
changed the title
Make wrapped lists/maps in PbList/PbMap monomorphic
Make wrapped lists in PbList monomorphic
Nov 22, 2023
@mkustermann I mostly rewrote this PR, ptal. |
osa1
added a commit
to osa1/protobuf.dart
that referenced
this pull request
Nov 22, 2023
This improves iteration performance by making `moveNext` and `current` direct calls in kernel. google#902 does not have the same effect on `moveNext` and `current` calls, this change is needed even with google#902. This change was not possible before google#880 as users could override the list and map types to types that are not `PbList`s or `PbMap`s.
mkustermann
approved these changes
Nov 23, 2023
osa1
added a commit
that referenced
this pull request
Nov 23, 2023
This improves iteration performance by making `moveNext` and `current` direct calls in kernel. #902 does not have the same effect on `moveNext` and `current` calls, this change is needed even with #902. This change was not possible before #880 as users could override the list and map types to types that are not `PbList`s or `PbMap`s. Note: changes in the message field types (the plugin changes in this PR) are not necessary for the kernel improvements, but it doesn't hurt to generate more precise types everywhere.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In
PbList
, the list field becomes monomorphic growable list (from the list base class). This makesadd
calls monomorphic and inlinable, and avoids double mutability checks (once inPbList.add
, again in_wrappedList.add
).Also simplifies immutable
PbMap
allocations.PbMap._isReadonly
is renamed to_isReadOnly
for consistency withPbList._isReadOnly
.cl/585873554