Re: [PHP-DEV] Object getter method optimization

2016-04-01 Thread Dmitry Stogov
other methods. I don't see any visible performance change on real-life apps. Thanks. Dmitry. From: Lin Yo-An Sent: Friday, April 1, 2016 19:14 To: Dmitry Stogov Cc: internals; Xinchen Hui; Nikita Popov Subject: Re: [PHP-DEV] Object getter method optimizati

Re: [PHP-DEV] Object getter method optimization

2016-04-01 Thread Lin Yo-An
ime inlining" approach may work. >>> >>> >>> PHP compiler (or optimizer) may mark functions and methods suitable for >>> "run-time" inlining (e.g. methods without arguments and FETCH_OBJ_R UNUSED, >>> CONST -> TMP; RETURN TMP). >>> >>&g

Re: [PHP-DEV] Object getter method optimization

2016-04-01 Thread Lin Yo-An
TCH_OBJ_R UNUSED, >> CONST -> TMP; RETURN TMP). >> >> Then INIT_METHOD_CALL may check this flag and execute "optimized code >> sequence" instead of pushing stack frame and real call. >> >> >> However, I'm not sure what kind of performance impact this

Re: [PHP-DEV] Object getter method optimization

2016-04-01 Thread Xinchen Hui
H_OBJ_R UNUSED, >> CONST -> TMP; RETURN TMP). >> >> Then INIT_METHOD_CALL may check this flag and execute "optimized code >> sequence" instead of pushing stack frame and real call. >> >> >> However, I'm not sure what kind of performance impact this

Re: [PHP-DEV] Object getter method optimization

2016-04-01 Thread Lin Yo-An
ditional check on each INIT_METHOD_CALL > execution. > > > Thanks. Dmitry. > > > ---------------------- > *From:* Lin Yo-An > *Sent:* Saturday, March 19, 2016 10:08 > *To:* Dmitry Stogov > *Cc:* internals; Xinchen Hui > *Subject:* Re: [PHP-DEV] Object gett

Re: [PHP-DEV] Object getter method optimization

2016-03-22 Thread Dmitry Stogov
From: Lin Yo-An Sent: Saturday, March 19, 2016 10:08 To: Dmitry Stogov Cc: internals; Xinchen Hui Subject: Re: [PHP-DEV] Object getter method optimization Hi Dmitry, Thanks for your reply! You're correct. let me try to explain your points: If I have a main.php and worker

Re: [PHP-DEV] Object getter method optimization

2016-03-20 Thread Dmitry Stogov
Hi Yo-An Lin, Unfortunately, this approach won't work. At first, at compile time we don't know the body of called getter. At second, the called method might be changed even at run-time, because of polymorphism. Tricks like this might be implemented using JIT and polymorphic inline caches. Thank

Re: [PHP-DEV] Object getter method optimization

2016-03-20 Thread Nikita Nefedov
On Sat, 19 Mar 2016 23:40:09 +0300, Andrea Faulds wrote: Hi Lin, Lin Yo-An wrote: Since the original approach doesn't work, here comes another new idea: When executing method call on an object, if we found the method body are just 2 op codes (FETCH_OBJ_R and RETURN), we then denote the metho

Re: [PHP-DEV] Object getter method optimization

2016-03-19 Thread Andrea Faulds
Hi Lin, Lin Yo-An wrote: Since the original approach doesn't work, here comes another new idea: When executing method call on an object, if we found the method body are just 2 op codes (FETCH_OBJ_R and RETURN), we then denote the method is a "getter method" And the next time, when we execute t

Re: [PHP-DEV] Object getter method optimization

2016-03-19 Thread Lin Yo-An
Hi Dmitry, Thanks for your reply! You're correct. let me try to explain your points: If I have a main.php and worker.php And I defined work($worker) { $status = $worker->getStatus(); } inside main.php when main.php is compiled, we don't know what the class entry of $worker is. What we only kno