-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Lazily Create Singular Wrapper Message #6833
Conversation
Need check type of field before getting submsg def
* Update upb to fix Timestamp conformance tests * Fix segmentation fault for oneof wrapper fields
…ess wrapper 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.
Can you also document the motivation of this PR please (a few paragraphs in the PR summary would suffice)? It seems that it has to do with the usage of well known wrapper to replace primitive fields, and to improve performance for object creation by lazily creating these wrapper objects. But it isn't clear from just the PR title.
Please also document that there are protoc
code generator changes but things are backward compatible.
* Register additional handlers from wrappers * Return zval instead of parse frame * Use parse frame * Update upb * Lazily create wrapper messages * Fix a segment fault Need check type of field before getting submsg def * Avoid expanding during serialization and direct access * Fix a bug that getXXXUnwrapped returns null for string * Implement writeWrapperUnwrapped * Add more tests * Fix oneof wrapper parsing * Fix get oneof field * Avoid expansion for oneof wrappers * Fix bug * Fix a bug that in php7 variable is defined out of scope * Fix broken tests * Update upb to fix Timestamp conformance tests * Fix segmentation fault for oneof wrapper fields * Fix encoding/decoding top level wrapper values * Add type checking for write wrapper value in php7 * Fix zts build * Fix the bug that readWrapperValue uses parent message's layout to access wrapper value * Fix wrapper in map
In order to mimic proto2 presence semantic in proto3, some users use lots of well known wrapper to replace primitive fields. This causes the problem of performance, because object creation is expensive.
This change lazily creates wrapper objects, which saves lots of time for unnecessary object creation/deletion.
In order to use the new feature, users needs to use the protoc in this change to update their generated code. However, old generated code is still compatible with the new runtime.