PHPBench is a benchmark suite for PHP. It performs a large number of simple tests in order to bench various aspects of the PHP interpreter. PHPBen
ch can be used to compare hardware, operating systems, PHP versions, PHP accelerators and caches, compiler options, etc. The number of iterations
used is 1,000,000.
Here is what a single run of the test looks like:
/usr/bin/php phpbench.php -i 1000000 Starting the benchmark with 1000000 iterations. Test [test_casting] enabled. Test [test_compare_unstrict] enabled. Test [test_time] enabled. Test [test_is_type] enabled. Test [test_compare_invert] enabled. Test [test_comment_loop] enabled. Test [test_rand] enabled. Test [test_foreach] enabled. Test [test_constants] enabled. Test [test_line] enabled. Test [test_local_float_assign] enabled. Test [test_md5] enabled. Test [test_compare_false] enabled. Test [test_chr_fixed] enabled. Test [test_is_array] enabled. Test [test_isset] enabled. Test [test_local_scalar_assign] enabled. Test [test_bitwise] enabled. Test [test_ereg] enabled. Test [test_sha1] enabled. Test [test_ord] enabled. Test [test_microtime] enabled. Test [test_unordered_functions] enabled. Test [test_string_append] enabled. Test [test_get_class] enabled. Test [test_compare] enabled. Test [test_references] enabled. Test [test_local_hash_assign] enabled. Test [test_variable_variables] enabled. Test [test_chr_hardcoded] enabled. Test [test_arithmetic] enabled. Test [test_ordered_functions] enabled. Test [test_is_object] enabled. Test [test_local_string_assign] enabled. Test [test_ordered_functions_references] enabled. Test [test_local_integer_assign] enabled. Test [test_strlen] enabled. Test [test_mt_rand] enabled. Test [test_local_object_assign] enabled. Test [test_local_boolean_assign] enabled. Test [test_do_while_break] enabled. Test [test_crc32] enabled. Test [test_preg_match] enabled. Test [test_if_constant] enabled. Test [test_array_operators] enabled. Test [test_switch] enabled. Test [test_global_scalar_assign] enabled. Test [test_compare_strict] enabled. Test [test_chr_var] enabled. Test [test_local_array_assign] enabled. Test [test_global_string_assign] enabled. Test [test_do_while] enabled. Test [test_increment] enabled. Test [test_empty] enabled. Test [test_while] enabled. Test [test_empty_loop] enabled. test_arithmetic 0.0688 seconds. test_array_operators 0.3312 seconds. test_bitwise 0.0352 seconds. test_casting 1.8972 seconds. test_chr_fixed 0.5846 seconds. test_chr_hardcoded 0.5895 seconds. test_chr_var 0.7932 seconds. test_comment_loop 0.2195 seconds. test_compare 0.1421 seconds. test_compare_false 0.0097 seconds. test_compare_invert 0.0117 seconds. test_compare_strict 0.0169 seconds. test_compare_unstrict 0.0487 seconds. test_constants 0.0929 seconds. test_crc32 0.0631 seconds. test_do_while 0.8829 seconds. test_do_while_break 0.1521 seconds. test_empty 0.0118 seconds. test_empty_loop 0.2196 seconds. test_ereg 0.1876 seconds. test_foreach 1.1988 seconds. test_get_class 0.0437 seconds. test_global_scalar_assign 0.1798 seconds. test_global_string_assign 0.3544 seconds. test_if_constant 0.0169 seconds. test_increment 0.0651 seconds. test_is_array 0.0104 seconds. test_is_object 0.0108 seconds. test_is_type 0.0328 seconds. test_isset 0.0149 seconds. test_line 0.0228 seconds. test_local_array_assign 0.4850 seconds. test_local_boolean_assign 0.0475 seconds. test_local_float_assign 0.0474 seconds. test_local_hash_assign 0.0682 seconds. test_local_integer_assign 0.0480 seconds. test_local_object_assign 0.0557 seconds. test_local_scalar_assign 0.0725 seconds. test_local_string_assign 0.2820 seconds. test_md5 0.2105 seconds. test_microtime 0.5111 seconds. test_mt_rand 0.0325 seconds. test_ord 1.6176 seconds. test_ordered_functions 0.7706 seconds. test_ordered_functions_references 1.5975 seconds. test_preg_match 0.1469 seconds. test_rand 0.0323 seconds. test_references 0.0281 seconds. test_sha1 0.2728 seconds. test_string_append 0.2264 seconds. test_strlen 0.0142 seconds. test_switch 0.4042 seconds. test_time 0.0260 seconds. test_unordered_functions 0.9042 seconds. test_variable_variables 0.0939 seconds. test_while 0.8813 seconds. System : Linux popayan 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 PHP version: 7.2.5-0ubuntu0.18.04.1 PHPBench : 0.8.1 Date : May 19, 2018, 1:14 pm Tests : 56 Iterations : 1000000 Total time : 17 seconds Score : 581884 (higher is better)
Phoronix runs 1000000 iterations (as above). The tests are single threaded and have been run pinned to core 1.
Metrics (Intel) - phoronix/phpbenchsh - pid 13976 On_CPU 0.125 On_Core 1.000 IPC 2.759 Retire 0.675 (67.5%) FrontEnd 0.155 (15.5%) Spec 0.021 (2.1%) Backend 0.148 (14.8%) Elapsed 16.91 Procs 3 Maxrss 19K Minflt 1616 Majflt 0 Inblock 0 Oublock 16 Msgsnd 0 Msgrcv 0 Nsignals 0 Nvcsw 18 (50.0%) Nivcsw 18 Utime 16.906829 Stime 0.004483 Start 388967.70 Finish 388984.61
The code runs On_core almost 100%. It has a high IPC with approximately equal amounts of frontend and backend stalls.
sh - pid 11567 On_CPU 0.062 On_Core 0.999 IPC 2.168 FrontCyc 0.160 (16.0%) BackCyc 0.310 (31.0%) Elapsed 22.56 Procs 3 Maxrss 19K Minflt 1620 Majflt 0 Inblock 0 Oublock 16 Msgsnd 0 Msgrcv 0 Nsignals 0 Nvcsw 18 (0.8%) Nivcsw 2132 Utime 22.540760 Stime 0.004963 Start 399091.76 Finish 399114.32
IPC on AMD is somewhat lower.
Process Tree - phoronix/phpbench
Process Tree
The process tree is simple
13976) sh elapsed=16.91 start=2.66 finish=19.57 13977) phpbench elapsed=16.91 start=2.66 finish=19.57 13978) php elapsed=16.91 start=2.66 finish=19.57
The code is scheduled 100% on one core.
IPC is high but varies some over the run.
Consistent with varying retirement rates are occasional higher frontend and backend stalls.
Next steps: Understand why IPC is somewhat lower for AMD.