-
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
Implement lazy loading of php class for proto messages #6911
Conversation
@@ -1356,15 +1366,6 @@ void add_handlers_for_message(const void* closure, upb_handlers* h) { | |||
return; | |||
} | |||
|
|||
// Ensure layout exists. We may be invoked to create handlers for a given |
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 understand why we can remove this
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 has been done in register_class
@@ -817,6 +821,7 @@ void internal_add_generated_file(const char* data, PHP_PROTO_SIZE data_len, | |||
bool use_nested_submsg TSRMLS_DC); | |||
void init_generated_pool_once(TSRMLS_D); | |||
void add_handlers_for_message(const void* closure, upb_handlers* h); | |||
void register_class(void *desc, bool is_enum TSRMLS_DC); |
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.
So is register_class
a function that already existed before this PR?
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.
It existed as a static method in def.c.
In this change, I refactored a little to make it easy to use.
…rs#6911) * Implement lazy loading of php class for proto messages * Fix php 7.1 * Fix encode * Fix memory leak * Fix enum descriptor
…rs#6911) * Implement lazy loading of php class for proto messages * Fix php 7.1 * Fix encode * Fix memory leak * Fix enum descriptor
Previously, when creating a message, all messages defined in the same proto file and transitive proto files need to be resolved by php engine, even though some of them are not needed.
This change lazily resolve php classes of proto messages, so that they are only needed if the actual message is created.