Profiling PHP
| From: | Rasmus Lerdorf | Date: | Mon, 13 May 2002 14:42:12 +0000 |
| Subject: | Profiling PHP | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-83993@lists.php.net to get a copy of this message | ||
I did a quick little profile of a lightly hit PHP server running a variety
of PHP apps such as IMP, Gallery and a couple of small MySQL-driven apps.
A semi-representative tiny snapshot of what I would consider normal usage
of PHP. I threw oprofile at it (oprofile.sourceforge.org) and here are
the results:
Cpu type: PIII
Cpu speed was (MHz estimation) : 868.000000
Counter 0 counted CPU_CLK_UNHALTED events (clocks processor is not halted)
with a unit mask of 0x00 (Not set) count 600000
vma samples %-age symbol name
001a56bc 1018 19.7096 zendparse
001a9f4c 369 7.14424 lex_scan
001b1ea4 349 6.75702 _emalloc
001d4ca0 326 6.31171 execute
001b21b8 301 5.82769 _efree
001cdaf8 238 4.60794 zend_inline_hash_func
001ca85c 238 4.60794 zend_hash_add_or_update
001f5960 171 3.31075 mail_msgno
001b3028 170 3.29138 _mem_block_check
0015dcb4 127 2.45886 php_var_unserialize
001ccae0 120 2.32333 zend_hash_find
001baf6c 81 1.56825 _zval_ptr_dtor
001c443c 69 1.33591 _zval_dtor
0015701c 66 1.27783 smart_str_print_unsigned
001cbda8 53 1.02614 zend_hash_destroy
001db270 51 0.987415 _get_zval_ptr
001ca5f8 48 0.929332 _zend_is_inconsistent
00156c08 43 0.832527 smart_str_appendl_ex
001cb9b8 41 0.793804 zend_hash_rehash
001cc6cc 39 0.755082 zend_hash_copy
001f64d0 36 0.696999 mail_gc_msg
0015ef14 33 0.638916 process_nested_data
001563b0 33 0.638916 php_var_serialize_intern
001b27fc 31 0.600194 _estrndup
00208200 29 0.561471 mm_blocknotify
0015ee18 28 0.54211 var_push
001c45c0 27 0.522749 zval_add_ref
0015f2b4 26 0.503388 parse_iv2
001bdaf0 25 0.484027 destroy_op_array
001c4970 24 0.464666 _zval_ptr_dtor_wrapper
001cb3b4 22 0.425944 zend_hash_index_update_or_next_insert
001b2440 21 0.406583 _erealloc
001c3560 20 0.387222 zend_str_tolower
001b9970 20 0.387222 zendlex
001c3dfc 19 0.367861 zend_ptr_stack_n_push
001d398c 18 0.3485 zend_fetch_var_address
001c83cc 17 0.329138 add_next_index_long
001c45d0 17 0.329138 _zval_copy_ctor
001bdcd0 16 0.309777 init_op
Not all that useful. Would be cool to run this for longer on a busy site
to get more accurate numbers. It does give some indication of where small
code optimizations would make the biggest overall difference.
-Rasmus