Guys, what was the reasoning behind the mmap in
php_stream_open_for_zend_ex()?  Especially for small files, I don't see
a speedup here, and because of some rather sub-optimal fstat behaviour
it seems like this has slowed things down quite a bit.

See http://bugs.php.net/49383

We now have 3 fstats on the same file between the open() and the mmap()
on every compile.   The 3 paths to the fstat look like this:

#1  0x0137642f in do_fstat ()
#2  0x0137768f in _php_stream_fopen ()
#3  0x013719ba in _php_stream_open_wrapper_ex ()
#4  0x0135a1a3 in php_stream_open_for_zend_ex ()
#5  0x0135a2e0 in php_stream_open_for_zend ()
#6  0x013ca05f in zend_stream_fixup ()
#7  0x01383ae7 in open_file_for_scanning ()
#8  0x01383c8d in compile_file ()
#9  0x011eb8f7 in phar_compile_file ()
#10 0x013b4fa7 in zend_execute_scripts ()
#11 0x0135be38 in php_execute_script ()

#1  0x0137642f in do_fstat ()
#2  0x01376ee1 in php_stdiop_stat ()
#3  0x0135a148 in php_zend_stream_fsizer ()
#4  0x0135a206 in php_stream_open_for_zend_ex ()
#5  0x0135a2e0 in php_stream_open_for_zend ()
#6  0x013ca05f in zend_stream_fixup ()
#7  0x01383ae7 in open_file_for_scanning ()
#8  0x01383c8d in compile_file ()
#9  0x011eb8f7 in phar_compile_file ()
#10 0x013b4fa7 in zend_execute_scripts ()
#11 0x0135be38 in php_execute_script ()

#1  0x0137642f in do_fstat ()
#2  0x01377189 in php_stdiop_set_option ()
#3  0x0136fc8e in _php_stream_set_option ()
#4  0x0137dcec in _php_stream_mmap_range ()
#5  0x0135a295 in php_stream_open_for_zend_ex ()
#6  0x0135a2e0 in php_stream_open_for_zend ()
#7  0x013ca05f in zend_stream_fixup ()
#8  0x01383ae7 in open_file_for_scanning ()
#9  0x01383c8d in compile_file ()
#10 0x011eb8f7 in phar_compile_file ()
#11 0x013b4fa7 in zend_execute_scripts ()
#12 0x0135be38 in php_execute_script ()

Each of those do_fstat() calls sets the 'force' flag which ignores the
cached stat struct and these are called in rapid succession from
php_stream_open_for_zend_ex in main/main.c

As far as I am concerned, we don't need any of those stats.  Not even
the first one for the top-level script.  sapi_get_stat() will give us
the stat struct from the sapi-level stat which has already been done and
all those forced stats make mmap'ing small files smaller than simply
reading them.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to