-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[WIP] accessor optimization #1847
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
Conversation
Would be great to see numbers in a real app, e.g. Wordpress |
struct { | ||
zend_uchar type; // the accessor type (getter or setter) | ||
uint32_t property_offset; | ||
} accessor; |
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's not great to extend all op_arrays with rarely used fields for getters only.
d235421
to
656ffb7
Compare
I am not quiet sure if the code below makes sense, however it fixes the tests: if (nextop->result_type == IS_VAR) {
ZVAL_DEREF(retval);
ZVAL_COPY(EX_VAR(nextop->result.var), retval);
assigned_result = 1;
} |
I thought copying value should be done by the code below? ZVAL_COPY_VALUE(EX_VAR(nextop->result.var), retval);
if (UNEXPECTED(Z_OPT_COPYABLE_P(EX_VAR(nextop->result.var)))) {
zval_copy_ctor_func(EX_VAR(nextop->result.var));
} |
Tests are passing now. I will clean up and refine them tomorrow. |
e721893
to
0409f98
Compare
2b42c73
to
f70b140
Compare
- Added accessor struct to op_array struct for saving accessor information. - Added accessor checking in pass_two() for getter functions. - Added quick property getter in INIT_METHOD_CALL op handler - Added strict condition when compiling getter accessors
will send this PR later when func info is ready is the core. |
Implement property getter optimization to make getter methods 2 times faster
Optimization Targets
Simple getters
Const accessor
Simple setters
Changes
information.
Benchmark Result
Getter Method Only
https://gist.github.com/8cd230a5601cbe38439661adf3caca0d
Without getter optimization (3 runs):
151.0169506073ms
With getter optimization (3 runs)
39.201021194458ms
Affect
Other Microbench result: https://gist.github.com/c9s/0273ac21631562724cabf86c42e86e32