Re: Expose zend_message_dispatcher_p
| From: | Laruence | Date: | Wed, 21 Nov 2012 07:56:16 +0000 |
| Subject: | Re: Expose zend_message_dispatcher_p | ||
| References: | 1 2 | Groups: | php.internals php.pecl.dev |
| Request: | Send a blank email to internals+get-64015@lists.php.net to get a copy of this message | ||
On Wed, Nov 21, 2012 at 2:35 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> [see below]
>
> On Wed, Nov 21, 2012 at 6:39 AM, Laruence <laruence@php.net> wrote:
>>
>> Hey:
>>
>> This problem come out when I was figuring a performance issue of
>> Yaf_Loader.
>>
>> Yaf provides a autoloader like PSR0, when doing a classes
>> autoloading. it used to:
>>
>> 1. stat the file, if file does not exists, return
>> 2. zend_compile_file
>>
>> this is okey when you run yaf without opcode cache.
>>
>> but when you run yaf with opcode cache, the first stat syscall
>> become a little waste.
>
>
> You should just use virtual_realpath() or tsrm_realpath() instead of
> stat(). They must utilise realpath cache and avoid stat() calls.
Hey:
Thanks, Dmitry,
actually, I didn't do like that is because by default, realpath
cache has 2min ttl.
but, after a second think, I think this will be better than my
current tricky implementation.. I will try in this way :)
thanks
>
> Thanks. Dmitry.
>
>>
>> since opcode cache always hook the zend_compile_file, and compile
>> the file from cache.
>>
>> so, I changed the autoload to:
>>
>> 1. zend_compile_file
>> 2. if compile failed, then return.
>>
>> but, zend_compile_file will throw warning if the file doesn't
>> exists via zend_message_dispatcher_p
>>
>> so if zend_message_dispatcher_p is ZEND_API, then I can avoid using
>> such mess codes:
>>
>> https://github.com/laruence/php-yaf/blob/master/yaf_loader.c#L377
>>
>> what do you think?
>>
>>
>> thanks
>> --
>> Laruence Xinchen Hui
>> http://www.laruence.com/
>
>
--
Laruence Xinchen Hui
http://www.laruence.com/