[PHP-DEV] Re: Object getter method optimization

2016-04-12 Thread Lin Yo-An
On Mon, Apr 11, 2016 at 11:53 PM, Dmitry Stogov wrote: > Or... maybe we shall move the function info related functions into the > core? since we might have some optimization based on the function info > instead of optimizing opcode only in the future. > > We consider,

[PHP-DEV] Re: Object getter method optimization

2016-04-11 Thread Dmitry Stogov
I think, It's going to be a part of opcache. Today, all PHP processes use shared bytecode, with JIT we will in addition share the native code. Thanks. Dmitry. From: Lin Yo-An Sent: Monday, April 11, 2016 19:04 To: Dmitry Stogov Cc:

[PHP-DEV] Re: Object getter method optimization

2016-04-11 Thread Lin Yo-An
On Mon, Apr 11, 2016 at 11:53 PM, Dmitry Stogov wrote: > > > We consider, possibility of moving the whole Optimizer into Zend, but it > won't change a lot, because expensive optimization make sense only with > opcache (when script is optimized once and executed many times). >

[PHP-DEV] Re: Object getter method optimization

2016-04-11 Thread Dmitry Stogov
Hi Yo-An On 04/11/2016 02:54 PM, Lin Yo-An wrote: Hi Dmitry, How's it going? I traversed the code of opcache extension, and just found the FUNC_INFO related macros. I guess the accessor information is more like an entry that should be put in the function info. That, FUNC_INFO is

[PHP-DEV] Re: Object getter method optimization

2016-04-11 Thread Lin Yo-An
Hi Dmitry, How's it going? I traversed the code of opcache extension, and just found the FUNC_INFO related macros. I guess the accessor information is more like an entry that should be put in the function info. Or... maybe we shall move the function info related functions into the core? since

[PHP-DEV] Re: Object getter method optimization

2016-04-07 Thread Lin Yo-An
Yeah I know. I've saw that yesterday.

[PHP-DEV] Re: Object getter method optimization

2016-04-07 Thread Dmitry Stogov
did you see my patch? It already uses run_time_cache of calling op_array to get getter property offset. It's also possible to "allocate" slots in "run_time_cache" of caller op_array at compile_time, increasing op_array->cache_size. (see zend_compile.c), but I don't see a big reason to do it.

[PHP-DEV] Re: Object getter method optimization

2016-04-05 Thread Lin Yo-An
On Tue, Apr 5, 2016 at 10:14 PM, Dmitry Stogov wrote: > I think, op_array->type and op_array->fn_flags can't be reused. > > Also, usage of op_array->run_time_cache is safer (I remember, I saw some > SIGSEGV with your patch and opcache.protect_memory=1) > Got it.Does

[PHP-DEV] Re: Object getter method optimization

2016-04-05 Thread Lin Yo-An
I updated my PR here https://github.com/php/php-src/pull/1847/files#diff-3054389ad750ce9a9f5895cd6d27800fR3159 On Tue, Apr 5, 2016 at 10:02 PM, Lin Yo-An wrote: > sorry, one typo, the "op_array->type" should be "op_array->fn_flags" > -- Best Regards, Yo-An Lin

[PHP-DEV] Re: Object getter method optimization

2016-04-05 Thread Lin Yo-An
sorry, one typo, the "op_array->type" should be "op_array->fn_flags"

[PHP-DEV] Re: Object getter method optimization

2016-04-05 Thread Dmitry Stogov
I think, op_array->type and op_array->fn_flags can't be reused. Also, usage of op_array->run_time_cache is safer (I remember, I saw some SIGSEGV with your patch and opcache.protect_memory=1) Most probably, I'll able to return to this idea only at the end of the week or even on next week.

[PHP-DEV] Re: Object getter method optimization

2016-04-05 Thread Lin Yo-An
Hi Dmitry, Glad to hear your news, I just checked your patch and I like the approach you've done. :] I'm also still working on this idea this week, the const value accessor support was just added today. And I guess we may also support setters in the future (if possible) my thought is: - I

[PHP-DEV] Re: Object getter method optimization

2016-04-05 Thread Dmitry Stogov
Hi Yo-An Lin, I spent few hours working on your idea and came to the following path. https://gist.github.com/dstogov/2221ffc21ac16311c958a4830dbcee0f I tried to keep binary compatibility, minimize run-time checks overhead and fix related problems and leaks. BTW I'm not sure, if I like the

[PHP-DEV] Re: Object getter method optimization

2016-04-03 Thread Lin Yo-An
I submitted the new benchmark result here: Benchmark ResultGetter Method Only https://gist.github.com/8cd230a5601cbe38439661adf3caca0d Without getter optimization (3 runs): 151.0169506073ms With getter optimization (3 runs) 39.201021194458ms Template Engine Benchmark

[PHP-DEV] Re: Object getter method optimization

2016-04-01 Thread Lin Yo-An
Hi Xinchen Hui, The magic get method is not being optimized. This optimization only focuses on simple getter, which is used in a lot of OO-based appoications like Symfony or Drupal. Hi Dimitry, Thanks for reviewing the code, comments are helpful. :) could you explain a little bit of how

[PHP-DEV] Re: Object getter method optimization

2016-03-21 Thread Lin Yo-An
> > >> I was playing with this idea sometime ago, it gives good performance > boost for code like `for ($i = 0; $i < 10; $i++) $a->getFoo();` but in > the end of the day it's a very limited optimization. > If you abstract away from getters and say you want to optimize more and > more small