From 61edfa17eb1b13783d7634f5cbbd8db987be3562 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: 2023年5月11日 12:18:28 +0300 Subject: [PATCH 01/18] =?UTF-8?q?=D0=92=D0=B5=D1=80=D0=B8=D1=8F=201.0.52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - вывод навзания сервера - вывод даты-времени завершения работы - обновление вывода в формате json, machine --- CHANGELOG.md | 5 +++++ bench.php | 35 ++++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 634baa5..6453513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +@ 2023年05月11日, v1.0.52 + + * Вывод названия сервера, даты-времени завершения работы, + * обновление вывода в формате JSON, machine + @ 2023年02月17日, v1.0.51 * Добавили поддержку php-8.2 diff --git a/bench.php b/bench.php index afc4807..6c2ad74 100644 --- a/bench.php +++ b/bench.php @@ -9,8 +9,8 @@ # Company : Code24 BV, The Netherlands # # Author : Sergey Dryabzhinsky # # Company : Rusoft Ltd, Russia # -# Date : Feb 17, 2023 # -# Version : 1.0.51 # +# Date : May 11, 2023 # +# Version : 1.0.52 # # License : Creative Commons CC-BY license # # Website : https://github.com/rusoft/php-simple-benchmark-script # # Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script # @@ -18,7 +18,7 @@ ################################################################################ */ -$scriptVersion = '1.0.51'; +$scriptVersion = '1.0.52'; // Special string to flush buffers, nginx for example $flushStr = ''; @@ -225,6 +225,19 @@ function print_norm($msg) { } +if (!function_exists('gethostname')) { + // 5.3.0+ only + function gethostname() { + on_start(); + $last_str = system(`hostname -f`, $errcode); + if ($last_str !== false) { + return $last_str; + } + return ''; + } +} + + /* global command line options */ if (php_sapi_name() == 'cli') { @@ -1504,7 +1517,8 @@ function print_results_common() . str_pad("PHP BENCHMARK SCRIPT", $padHeader, " ", STR_PAD_BOTH) . "|\n$line\n" . str_pad("Start", $padInfo) . " : " . date("Y-m-d H:i:s") . "\n" - . str_pad("Server", $padInfo) . " : " . php_uname('s') . '/' . php_uname('r') . ' ' . php_uname('m') . "\n" + . str_pad("Server name", $padInfo) . " : " . gethostname() . "\n" + . str_pad("Server system", $padInfo) . " : " . php_uname('s') . '/' . php_uname('r') . ' ' . php_uname('m') . "\n" . str_pad("Platform", $padInfo) . " : " . PHP_OS . "\n" . str_pad("System", $padInfo) . " : " . get_current_os() . "\n" . str_pad("CPU", $padInfo) . " :\n" @@ -1577,6 +1591,9 @@ function print_results_common() } // show only system info? + echo "$line\n"; + echo str_pad("End", $padInfo) . " : " . date("Y-m-d H:i:s") . "\n"; + if (php_sapi_name() != 'cli') echo "\n"; flush(); @@ -1592,7 +1609,8 @@ function print_results_machine() echo "" . "PHP_BENCHMARK_SCRIPT: $scriptVersion\n" . "START: " . date("Y-m-d H:i:s") . "\n" - . "SERVER: " . php_uname('s') . '/' . php_uname('r') . ' ' . php_uname('m') . "\n" + . "SERVER_name: " . gethostname() . "\n" + . "SERVER_sys: " . php_uname('s') . '/' . php_uname('r') . ' ' . php_uname('m') . "\n" . "SYSTEM: " . get_current_os() . "\n" . "PHP_VERSION: " . PHP_VERSION . "\n" ; @@ -1627,6 +1645,8 @@ function print_results_machine() flush(); } + + echo "END: " . date("Y-m-d H:i:s") . "\n"; } function print_results_json() @@ -1639,7 +1659,8 @@ function print_results_json() echo "" . "\"php_benchmark_script\": \"$scriptVersion\",\n" . "\"start\": \"" . date("Y-m-d H:i:s") . "\",\n" - . "\"server\": \"" . php_uname('s') . '/' . php_uname('r') . ' ' . php_uname('m') . "\",\n" + . "\"server_name\": \"" . gethostname() . "\",\n" + . "\"server_sys\": \"" . php_uname('s') . '/' . php_uname('r') . ' ' . php_uname('m') . "\",\n" . "\"system\": \"" . get_current_os() . "\",\n" . "\"php_version\": \"" . PHP_VERSION . "\",\n" ; @@ -1679,7 +1700,7 @@ function print_results_json() echo $resultSecFmt . ", \"op\/sec\":" . $resultOps . ", \"op\/sec\/MHz\":" . $resultOpMhz . " },\n"; } print("\"messages_count\": {$messagesCnt},\n"); - print("\"end\":true\n}" . PHP_EOL); + print("\"end\":\"".date("Y-m-d H:i:s")."\"\n}" . PHP_EOL); flush(); } From 312a8fabb13a41239cda4324ce56100c7cd59b69 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Mon, 5 Jun 2023 22:40:13 +0300 Subject: [PATCH 02/18] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=B8=D1=8F-=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=201.0.52.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ bench.php | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6453513..18c8546 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +@ 2023年06月05日, v1.0.52.1 + + * Исправлен вывод даты звершения работы скрипта - выравнивание даты + @ 2023年05月11日, v1.0.52 * Вывод названия сервера, даты-времени завершения работы, diff --git a/bench.php b/bench.php index 6c2ad74..ec97499 100644 --- a/bench.php +++ b/bench.php @@ -9,8 +9,8 @@ # Company : Code24 BV, The Netherlands # # Author : Sergey Dryabzhinsky # # Company : Rusoft Ltd, Russia # -# Date : May 11, 2023 # -# Version : 1.0.52 # +# Date : Jun 05, 2023 # +# Version : 1.0.52.1 # # License : Creative Commons CC-BY license # # Website : https://github.com/rusoft/php-simple-benchmark-script # # Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script # @@ -18,7 +18,7 @@ ################################################################################ */ -$scriptVersion = '1.0.52'; +$scriptVersion = '1.0.52.1'; // Special string to flush buffers, nginx for example $flushStr = ''; @@ -1589,10 +1589,13 @@ function print_results_common() : '' ); - } // show only system info? + echo "$line\n"; + echo str_pad("End", $padLabel) . " : " . date("Y-m-d H:i:s") . "\n"; - echo "$line\n"; - echo str_pad("End", $padInfo) . " : " . date("Y-m-d H:i:s") . "\n"; + } // show only system info? + else { + echo str_pad("End", $padInfo) . " : " . date("Y-m-d H:i:s") . "\n"; + } if (php_sapi_name() != 'cli') echo "\n"; From b26e3cc53f1a752d43efd4c7a5a22bf2e2f0a147 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: 2023年9月14日 05:40:40 +0300 Subject: [PATCH 03/18] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.?= =?UTF-8?q?0.54=20=20=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D1=83=D0=BB=D1=8F=20igbinary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++ bench.php | 65 ++++++++++++++++++++++++++++++++++++++-- igbinary.inc | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 3 deletions(-) create mode 100644 igbinary.inc diff --git a/CHANGELOG.md b/CHANGELOG.md index 18c8546..3cb0c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +@ 2023年06月05日, v1.0.54 + + * Добавлены тесты igbinary + @ 2023年06月05日, v1.0.52.1 * Исправлен вывод даты звершения работы скрипта - выравнивание даты diff --git a/bench.php b/bench.php index ec97499..4c9da95 100644 --- a/bench.php +++ b/bench.php @@ -10,7 +10,7 @@ # Author : Sergey Dryabzhinsky # # Company : Rusoft Ltd, Russia # # Date : Jun 05, 2023 # -# Version : 1.0.52.1 # +# Version : 1.0.54 # # License : Creative Commons CC-BY license # # Website : https://github.com/rusoft/php-simple-benchmark-script # # Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script # @@ -18,7 +18,7 @@ ################################################################################ */ -$scriptVersion = '1.0.52.1'; +$scriptVersion = '1.0.54'; // Special string to flush buffers, nginx for example $flushStr = ''; @@ -67,6 +67,12 @@ /** ------------------------------- Main Defaults ------------------------------- */ +$has_igb = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('igbinary')) { + $has_igb = "{$colorGreen}yes{$colorReset}"; + @include("igbinary.inc"); +} + $originMemoryLimit = @ini_get('memory_limit'); $originTimeLimit = @ini_get('max_execution_time'); @@ -657,6 +663,8 @@ function gethostname() { '10_json_decode' => 1300000, '11_serialize' => 1300000, '12_unserialize' => 1300000, + '11_igb_serialize' => 1300000, + '12_igb_unserialize' => 1300000, '13_array_loop' => 250, '14_array_loop' => 250, '15_clean_loops' => 200000000, @@ -679,6 +687,8 @@ function gethostname() { '31_intl_message_format' => 200000, '32_intl_calendar' => 300000, '33_phpinfo_generate' => 10000, + '34_gd_qrcode' => 700, + '35_imagick_qrcode' => 200, ); // Should not be more than X Mb // Different PHP could use different amount of memory @@ -698,6 +708,8 @@ function gethostname() { '10_json_decode' => 4, '11_serialize' => 4, '12_unserialize' => 4, + '11_igb_serialize' => 4, + '12_igb_unserialize' => 4, // php-5.3 '13_array_loop' => 54, '14_array_loop' => 62, @@ -722,6 +734,8 @@ function gethostname() { '31_intl_message_format' => 14, '32_intl_calendar' => 14, '33_phpinfo_generate' => 14, + '34_gd_qrcode' => 14, + '35_imagick_qrcode' => 8, ); /** ---------------------------------- Common functions -------------------------------------------- */ @@ -1375,7 +1389,38 @@ function format_result_test($diffSeconds, $opCount, $memory = 0) } exit(1); } - +/* +if (is_file('php-gd.inc')) { + if (extension_loaded('gd')) { + include_once 'php-gd.inc'; + } else { + print_pre("${line}\n{$colorYellow}<<< WARNING>>>{$colorReset} Extension 'gd' not loaded or not compiled! Image manipulation tests will be skipped!\n$line"); + } +} else { + print_pre("$line\n{$colorRed}<<< ERROR>>>{$colorReset}\nMissing file 'php-gd.inc' with common tests!\n$line"); + if ($printJson) { + print("\"messages_count\": {$messagesCnt},\n"); + print("\"end\":true\n}" . PHP_EOL); + } + exit(1); +} +*/ +/* +if (is_file('php-imagick.inc')) { + if (extension_loaded('imagick')) { + include_once 'php-imagick.inc'; + } else { + print_pre("${line}\n{$colorYellow}<<< WARNING>>>{$colorReset} Extension 'imagick' not loaded or not compiled! Image manipulation tests will be skipped!\n$line"); + } +} else { + print_pre("$line\n{$colorRed}<<< ERROR>>>{$colorReset}\nMissing file 'php-imagick.inc' with common tests!\n$line"); + if ($printJson) { + print("\"messages_count\": {$messagesCnt},\n"); + print("\"end\":true\n}" . PHP_EOL); + } + exit(1); +} +*/ if ((int)$phpversion[0]>= 5) { if (is_file('php5.inc')) { include_once 'php5.inc'; @@ -1472,6 +1517,14 @@ function format_result_test($diffSeconds, $opCount, $memory = 0) if (extension_loaded('eAccelerator')) { $has_eacc = "{$colorYellow}yes{$colorReset}"; } +$has_gd = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('gd')) { + $has_gd = "{$colorGreen}yes{$colorReset}"; +} +$has_imagick = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('imagick')) { + $has_imagick = "{$colorGreen}yes{$colorReset}"; +} $has_xdebug = "{$colorGreen}no{$colorReset}"; if (extension_loaded('xdebug')) { print_pre("{$colorYellow}<<< WARNING>>>{$colorReset} Extension 'xdebug' loaded! It will affect results and slow things greatly! Even if not enabled!\n"); @@ -1508,6 +1561,7 @@ function print_results_common() global $line, $padHeader, $cpuInfo, $padInfo, $scriptVersion, $maxTime, $originTimeLimit, $originMemoryLimit, $cryptAlgoName, $memoryLimitMb; global $flushStr, $has_apc, $has_pcre, $has_intl, $has_json, $has_simplexml, $has_dom, $has_mbstring, $has_opcache, $has_xcache; + global $has_gd, $has_imagick, $has_igb; global $opcache, $has_eacc, $has_xdebug, $xcache, $apcache, $eaccel, $xdebug, $xdbg_mode, $obd_set, $mbover; global $showOnlySystemInfo, $padLabel, $functions, $runOnlySelectedTests, $selectedTests, $totalOps; global $colorGreen, $colorReset, $colorRed; @@ -1541,6 +1595,11 @@ function print_results_common() . str_pad("simplexml", $padInfo, ' ', STR_PAD_LEFT) . " : $has_simplexml; libxml version: ".LIBXML_DOTTED_VERSION."\n" . str_pad("dom", $padInfo, ' ', STR_PAD_LEFT) . " : $has_dom\n" . str_pad("intl", $padInfo, ' ', STR_PAD_LEFT) . " : $has_intl" . ($has_intl == "{$colorGreen}yes{$colorReset}" ? '; icu version: ' . INTL_ICU_VERSION : '')."\n" + . str_pad("-optional->", $padInfo, ' ', STR_PAD_LEFT) . "\n" + . str_pad("gd", $padInfo, ' ', STR_PAD_LEFT) . " : $has_gd\n" + . str_pad("imagick", $padInfo, ' ', STR_PAD_LEFT) . " : $has_imagick\n" + . str_pad("-alternative->", $padInfo, ' ', STR_PAD_LEFT) . "\n" + . str_pad("igbinary", $padInfo, ' ', STR_PAD_LEFT) . " : $has_igb\n" . str_pad("-affecting->", $padInfo, ' ', STR_PAD_LEFT) . "\n" . str_pad("opcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_opcache; enabled: {$opcache}\n" . str_pad("xcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_xcache; enabled: {$xcache}\n" diff --git a/igbinary.inc b/igbinary.inc new file mode 100644 index 0000000..a9d54fb --- /dev/null +++ b/igbinary.inc @@ -0,0 +1,83 @@ +fieldStr = 'value'; + $obj->fieldInt = 123456; + $obj->fieldFloat = 123.456; + $obj->fieldArray = array(123456); + $obj->fieldNull = null; + $obj->fieldBool = false; + $data[] = $obj; + + $count = $testsLoopLimits['11_igb_serialize']; + $time_start = get_microtime(); + for ($i = 0; $i < $count; $i++) { + foreach ($data as $value) { + $r = igbinary_serialize($value); + } + } + $totalOps += $count; + return format_result_test(get_microtime() - $time_start, $count, mymemory_usage()); +} + +function test_12_IGB_Unserialize() +{ + global $stringTest, $emptyResult, $testsLoopLimits, $totalOps; + + if (!function_exists('igbinary_unserialize')) { + return $emptyResult; + } + + $data = array( + $stringTest, + 123456, + 123.456, + array(123456), + null, + false, + ); + $obj = new stdClass(); + $obj->fieldStr = 'value'; + $obj->fieldInt = 123456; + $obj->fieldFloat = 123.456; + $obj->fieldArray = array(123456); + $obj->fieldNull = null; + $obj->fieldBool = false; + $data[] = $obj; + + foreach ($data as $key => $value) { + $data[$key] = igbinary_serialize($value); + } + + $count = $testsLoopLimits['12_igb_unserialize']; + $time_start = get_microtime(); + for ($i = 0; $i < $count; $i++) { + foreach ($data as $value) { + $r = igbinary_unserialize($value); + } + } + $totalOps += $count; + return format_result_test(get_microtime() - $time_start, $count, mymemory_usage()); +} From c658860448aa9fc1fac0bfa79a6fd3d1aa7ddcd5 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: 2023年9月14日 08:40:44 +0300 Subject: [PATCH 04/18] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20msgpack=20-=20=D0=B2=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D1=8F=D1=8F=201.0.55?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++ README.en.md | 13 +++++++- README.md | 15 ++++++++-- bench.php | 26 ++++++++++++++-- msgpack.inc | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 msgpack.inc diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cb0c66..ae9716e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +@ 2023年06月05日, v1.0.55 + + * Добавлены тесты msgpack + @ 2023年06月05日, v1.0.54 * Добавлены тесты igbinary diff --git a/README.en.md b/README.en.md index 87202d8..9ff3b9c 100644 --- a/README.en.md +++ b/README.en.md @@ -30,7 +30,7 @@ How to check it: ### 0. Files -You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `test.xml`. +You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `test.xml`. ### 1. Through the console @@ -152,6 +152,11 @@ Crypt hash algo : MD5 simplexml : yes; libxml version: 2.9.4 dom : yes intl : yes; icu version: 66.1 + -alternative-> + igbinary : yes + msgpack : yes + jsond : yes + jsond as json>> : yes -affecting-> opcache : yes; enabled: 0 xcache : no; enabled: 0 @@ -176,6 +181,12 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz | 08_2_crypt : 8.698 sec | 1.15 kOp/s | 0.30 Ops/MHz | 4 Mb 09_json_encode : 2.322 sec | 559.91 kOp/s | 147.78 Ops/MHz | 4 Mb 10_json_decode : 3.556 sec | 365.54 kOp/s | 96.48 Ops/MHz | 4 Mb +11_igb_serialize : 2.894 sec | 449.19 kOp/s | 124.78 Ops/MHz | 3 Mb +11_msgpack_pack : 2.054 sec | 633.01 kOp/s | 175.84 Ops/MHz | 3 Mb +11_serialize : 3.727 sec | 348.79 kOp/s | 96.89 Ops/MHz | 3 Mb +12_igb_unserialize : 2.123 sec | 612.31 kOp/s | 170.09 Ops/MHz | 3 Mb +12_msgpack_unpack : 2.657 sec | 489.30 kOp/s | 135.92 Ops/MHz | 3 Mb +12_unserialize : 3.226 sec | 402.91 kOp/s | 111.92 Ops/MHz | 3 Mb 11_serialize : 1.551 sec | 838.30 kOp/s | 221.25 Ops/MHz | 4 Mb 12_unserialize : 1.677 sec | 774.97 kOp/s | 204.54 Ops/MHz | 4 Mb 13_array_fill : 3.740 sec | 24.07 MOp/s | 6.35 kOps/MHz | 24 Mb diff --git a/README.md b/README.md index 13ae7b7..3fdae8c 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ ### 0. Файлы -Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `test.xml`. +Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `test.xml`. ### 1. Через консоль @@ -138,7 +138,7 @@ CPU : cores : 4 available : 4 MHz : 3600 MHz -Benchmark version : 1.0.47 +Benchmark version : 1.0.55 PHP version : 7.4.29-SergeyD/6.1 PHP time limit : 0 sec Setup time limit : 600 sec @@ -153,6 +153,11 @@ Crypt hash algo : MD5 simplexml : yes; libxml version: 2.9.4 dom : yes intl : yes; icu version: 66.1 + -alternative-> + igbinary : yes + msgpack : yes + jsond : yes + jsond as json>> : yes -affecting-> opcache : yes; enabled: 0 xcache : no; enabled: 0 @@ -177,6 +182,12 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz | 08_2_crypt : 8.698 sec | 1.15 kOp/s | 0.30 Ops/MHz | 4 Mb 09_json_encode : 2.322 sec | 559.91 kOp/s | 147.78 Ops/MHz | 4 Mb 10_json_decode : 3.556 sec | 365.54 kOp/s | 96.48 Ops/MHz | 4 Mb +11_igb_serialize : 2.894 sec | 449.19 kOp/s | 124.78 Ops/MHz | 3 Mb +11_msgpack_pack : 2.054 sec | 633.01 kOp/s | 175.84 Ops/MHz | 3 Mb +11_serialize : 3.727 sec | 348.79 kOp/s | 96.89 Ops/MHz | 3 Mb +12_igb_unserialize : 2.123 sec | 612.31 kOp/s | 170.09 Ops/MHz | 3 Mb +12_msgpack_unpack : 2.657 sec | 489.30 kOp/s | 135.92 Ops/MHz | 3 Mb +12_unserialize : 3.226 sec | 402.91 kOp/s | 111.92 Ops/MHz | 3 Mb 11_serialize : 1.551 sec | 838.30 kOp/s | 221.25 Ops/MHz | 4 Mb 12_unserialize : 1.677 sec | 774.97 kOp/s | 204.54 Ops/MHz | 4 Mb 13_array_fill : 3.740 sec | 24.07 MOp/s | 6.35 kOps/MHz | 24 Mb diff --git a/bench.php b/bench.php index 4c9da95..b882eb0 100644 --- a/bench.php +++ b/bench.php @@ -10,7 +10,7 @@ # Author : Sergey Dryabzhinsky # # Company : Rusoft Ltd, Russia # # Date : Jun 05, 2023 # -# Version : 1.0.54 # +# Version : 1.0.55 # # License : Creative Commons CC-BY license # # Website : https://github.com/rusoft/php-simple-benchmark-script # # Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script # @@ -18,7 +18,7 @@ ################################################################################ */ -$scriptVersion = '1.0.54'; +$scriptVersion = '1.0.55'; // Special string to flush buffers, nginx for example $flushStr = ''; @@ -73,6 +73,12 @@ @include("igbinary.inc"); } +$has_msg = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('msgpack')) { + $has_msg = "{$colorGreen}yes{$colorReset}"; + @include("msgpack.inc"); +} + $originMemoryLimit = @ini_get('memory_limit'); $originTimeLimit = @ini_get('max_execution_time'); @@ -665,6 +671,8 @@ function gethostname() { '12_unserialize' => 1300000, '11_igb_serialize' => 1300000, '12_igb_unserialize' => 1300000, + '11_msgpack_pack' => 1300000, + '12_msgpack_unpack' => 1300000, '13_array_loop' => 250, '14_array_loop' => 250, '15_clean_loops' => 200000000, @@ -1551,6 +1559,15 @@ function format_result_test($diffSeconds, $opCount, $memory = 0) $has_intl = "{$colorGreen}yes{$colorReset}"; } +$has_jsond = "{$colorYellow}no{$colorReset}"; +$has_jsond_as_json = "{$colorYellow}no{$colorReset}"; +if ($jsond = extension_loaded('jsond')) { + $has_jsond = "{$colorGreen}yes{$colorReset}"; +} +if ($jsond && !function_exists('jsond_encode')) { + $has_jsond_as_json = "{$colorGreen}yes{$colorReset}"; +} + if (!defined('PCRE_VERSION')) define('PCRE_VERSION', '-.--'); if (!defined('LIBXML_DOTTED_VERSION')) define('LIBXML_DOTTED_VERSION', '-.-.-'); if (!defined('INTL_ICU_VERSION')) define('INTL_ICU_VERSION', '-.-'); @@ -1561,7 +1578,7 @@ function print_results_common() global $line, $padHeader, $cpuInfo, $padInfo, $scriptVersion, $maxTime, $originTimeLimit, $originMemoryLimit, $cryptAlgoName, $memoryLimitMb; global $flushStr, $has_apc, $has_pcre, $has_intl, $has_json, $has_simplexml, $has_dom, $has_mbstring, $has_opcache, $has_xcache; - global $has_gd, $has_imagick, $has_igb; + global $has_gd, $has_imagick, $has_igb, $has_msg, $has_jsond, $has_jsond_as_json; global $opcache, $has_eacc, $has_xdebug, $xcache, $apcache, $eaccel, $xdebug, $xdbg_mode, $obd_set, $mbover; global $showOnlySystemInfo, $padLabel, $functions, $runOnlySelectedTests, $selectedTests, $totalOps; global $colorGreen, $colorReset, $colorRed; @@ -1600,6 +1617,9 @@ function print_results_common() . str_pad("imagick", $padInfo, ' ', STR_PAD_LEFT) . " : $has_imagick\n" . str_pad("-alternative->", $padInfo, ' ', STR_PAD_LEFT) . "\n" . str_pad("igbinary", $padInfo, ' ', STR_PAD_LEFT) . " : $has_igb\n" + . str_pad("msgpack", $padInfo, ' ', STR_PAD_LEFT) . " : $has_msg\n" + . str_pad("jsond", $padInfo, ' ', STR_PAD_LEFT) . " : $has_jsond\n" + . str_pad("jsond as json>>", $padInfo, ' ', STR_PAD_LEFT) . " : $has_jsond_as_json\n" . str_pad("-affecting->", $padInfo, ' ', STR_PAD_LEFT) . "\n" . str_pad("opcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_opcache; enabled: {$opcache}\n" . str_pad("xcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_xcache; enabled: {$xcache}\n" diff --git a/msgpack.inc b/msgpack.inc new file mode 100644 index 0000000..89d1b8c --- /dev/null +++ b/msgpack.inc @@ -0,0 +1,83 @@ +fieldStr = 'value'; + $obj->fieldInt = 123456; + $obj->fieldFloat = 123.456; + $obj->fieldArray = array(123456); + $obj->fieldNull = null; + $obj->fieldBool = false; + $data[] = $obj; + + $count = $testsLoopLimits['11_msgpack_pack']; + $time_start = get_microtime(); + for ($i = 0; $i < $count; $i++) { + foreach ($data as $value) { + $r = msgpack_pack($value); + } + } + $totalOps += $count; + return format_result_test(get_microtime() - $time_start, $count, mymemory_usage()); +} + +function test_12_msgpack_unpack() +{ + global $stringTest, $emptyResult, $testsLoopLimits, $totalOps; + + if (!function_exists('msgpack_unpack')) { + return $emptyResult; + } + + $data = array( + $stringTest, + 123456, + 123.456, + array(123456), + null, + false, + ); + $obj = new stdClass(); + $obj->fieldStr = 'value'; + $obj->fieldInt = 123456; + $obj->fieldFloat = 123.456; + $obj->fieldArray = array(123456); + $obj->fieldNull = null; + $obj->fieldBool = false; + $data[] = $obj; + + foreach ($data as $key => $value) { + $data[$key] = msgpack_pack($value); + } + + $count = $testsLoopLimits['12_msgpack_unpack']; + $time_start = get_microtime(); + for ($i = 0; $i < $count; $i++) { + foreach ($data as $value) { + $r = msgpack_unpack($value); + } + } + $totalOps += $count; + return format_result_test(get_microtime() - $time_start, $count, mymemory_usage()); +} From c1af84e2d46f626dcccbc8abc0da1929ca757616 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: 2023年9月14日 09:20:37 +0300 Subject: [PATCH 05/18] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.?= =?UTF-8?q?0.56=20-=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D1=82?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2=20=D1=81?= =?UTF-8?q?=D0=B6=D0=B0=D1=82=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 20 +++++++-- README.md | 20 +++++++-- bench.php | 53 ++++++++++++++++++++++- compression.inc | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 192 insertions(+), 10 deletions(-) create mode 100644 compression.inc diff --git a/README.en.md b/README.en.md index 9ff3b9c..2206049 100644 --- a/README.en.md +++ b/README.en.md @@ -30,7 +30,7 @@ How to check it: ### 0. Files -You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `test.xml`. +You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `compression.inc`, `test.xml`. ### 1. Through the console @@ -137,7 +137,7 @@ CPU : cores : 4 available : 4 MHz : 3600 MHz -Benchmark version : 1.0.51 +Benchmark version : 1.0.56 PHP version : 7.4.29-SergeyD/6.1 PHP time limit : 0 sec Setup time limit : 600 sec @@ -155,8 +155,14 @@ Crypt hash algo : MD5 -alternative-> igbinary : yes msgpack : yes - jsond : yes - jsond as json>> : yes + jsond : no + jsond as json>> : no + -compression-> + zlib : yes + bz2 : yes + lz4 : yes + zstd : yes + brotli : yes -affecting-> opcache : yes; enabled: 0 xcache : no; enabled: 0 @@ -214,6 +220,12 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz | 31_intl_message_format : 4.236 sec | 47.22 kOp/s | 12.46 Ops/MHz | 4 Mb 32_intl_calendar : 0.844 sec | 355.34 kOp/s | 93.79 Ops/MHz | 4 Mb 33_phpinfo_generate : 1.440 sec | 6.95 kOp/s | 1.83 Ops/MHz | 4 Mb +36_brotli_compress : 5.012 sec | 199.50 kOp/s | 51.47 Ops/MHz | 3 Mb +36_bzip2_compress : 22.065 sec | 22.66 kOp/s | 5.85 Ops/MHz | 3 Mb +36_gzip_compress : 52.977 sec | 94.38 kOp/s | 24.35 Ops/MHz | 3 Mb +36_lz4_compress : 0.378 sec | 1.32 MOp/s | 341.52 Ops/MHz | 3 Mb +36_zlib_compress : 51.905 sec | 96.33 kOp/s | 24.85 Ops/MHz | 3 Mb +36_zstd_compress : 27.937 sec | 178.98 kOp/s | 46.17 Ops/MHz | 3 Mb ------------------------------------------------------------------------------------------- Total time: : 81.337 sec | 13.73 MOp/s | 3.62 kOps/MHz | Current PHP memory usage: : 4 Mb diff --git a/README.md b/README.md index 3fdae8c..8788564 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ ### 0. Файлы -Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `test.xml`. +Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `compression.inc`, `test.xml`. ### 1. Через консоль @@ -138,7 +138,7 @@ CPU : cores : 4 available : 4 MHz : 3600 MHz -Benchmark version : 1.0.55 +Benchmark version : 1.0.56 PHP version : 7.4.29-SergeyD/6.1 PHP time limit : 0 sec Setup time limit : 600 sec @@ -156,8 +156,14 @@ Crypt hash algo : MD5 -alternative-> igbinary : yes msgpack : yes - jsond : yes - jsond as json>> : yes + jsond : no + jsond as json>> : no + -compression-> + zlib : yes + bz2 : yes + lz4 : yes + zstd : yes + brotli : yes -affecting-> opcache : yes; enabled: 0 xcache : no; enabled: 0 @@ -215,6 +221,12 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz | 31_intl_message_format : 4.236 sec | 47.22 kOp/s | 12.46 Ops/MHz | 4 Mb 32_intl_calendar : 0.844 sec | 355.34 kOp/s | 93.79 Ops/MHz | 4 Mb 33_phpinfo_generate : 1.440 sec | 6.95 kOp/s | 1.83 Ops/MHz | 4 Mb +36_brotli_compress : 5.012 sec | 199.50 kOp/s | 51.47 Ops/MHz | 3 Mb +36_bzip2_compress : 22.065 sec | 22.66 kOp/s | 5.85 Ops/MHz | 3 Mb +36_gzip_compress : 52.977 sec | 94.38 kOp/s | 24.35 Ops/MHz | 3 Mb +36_lz4_compress : 0.378 sec | 1.32 MOp/s | 341.52 Ops/MHz | 3 Mb +36_zlib_compress : 51.905 sec | 96.33 kOp/s | 24.85 Ops/MHz | 3 Mb +36_zstd_compress : 27.937 sec | 178.98 kOp/s | 46.17 Ops/MHz | 3 Mb ------------------------------------------------------------------------------------------- Total time: : 81.337 sec | 13.73 MOp/s | 3.62 kOps/MHz | Current PHP memory usage: : 4 Mb diff --git a/bench.php b/bench.php index b882eb0..e54491a 100644 --- a/bench.php +++ b/bench.php @@ -10,7 +10,7 @@ # Author : Sergey Dryabzhinsky # # Company : Rusoft Ltd, Russia # # Date : Jun 05, 2023 # -# Version : 1.0.55 # +# Version : 1.0.56 # # License : Creative Commons CC-BY license # # Website : https://github.com/rusoft/php-simple-benchmark-script # # Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script # @@ -18,7 +18,7 @@ ################################################################################ */ -$scriptVersion = '1.0.55'; +$scriptVersion = '1.0.56'; // Special string to flush buffers, nginx for example $flushStr = ''; @@ -79,6 +79,16 @@ @include("msgpack.inc"); } +if (extension_loaded('zstd')) { + @include_once("compression.inc"); +} +if (extension_loaded('lz4')) { + @include_once("compression.inc"); +} +if (extension_loaded('brotli')) { + @include_once("compression.inc"); +} + $originMemoryLimit = @ini_get('memory_limit'); $originTimeLimit = @ini_get('max_execution_time'); @@ -697,6 +707,12 @@ function gethostname() { '33_phpinfo_generate' => 10000, '34_gd_qrcode' => 700, '35_imagick_qrcode' => 200, + '36_zlib_compress' => 5000000, + '36_gzip_compress' => 5000000, + '36_bzip2_compress' => 500000, + '36_lz4_compress' => 5000000, + '36_zstd_compress' => 5000000, + '36_brotli_compress' => 1000000, ); // Should not be more than X Mb // Different PHP could use different amount of memory @@ -744,6 +760,12 @@ function gethostname() { '33_phpinfo_generate' => 14, '34_gd_qrcode' => 14, '35_imagick_qrcode' => 8, + '36_zlib_compress' => 4, + '36_gzip_compress' => 4, + '36_bzip2_compress' => 4, + '36_lz4_compress' => 4, + '36_zstd_compress' => 4, + '36_brotli_compress' => 4, ); /** ---------------------------------- Common functions -------------------------------------------- */ @@ -1558,6 +1580,26 @@ function format_result_test($diffSeconds, $opCount, $memory = 0) if (extension_loaded('intl')) { $has_intl = "{$colorGreen}yes{$colorReset}"; } +$has_zlib = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('zlib')) { + $has_zlib = "{$colorGreen}yes{$colorReset}"; +} +$has_bz2 = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('bz2')) { + $has_bz2 = "{$colorGreen}yes{$colorReset}"; +} +$has_lz4 = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('lz4')) { + $has_lz4 = "{$colorGreen}yes{$colorReset}"; +} +$has_zstd = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('zstd')) { + $has_zstd = "{$colorGreen}yes{$colorReset}"; +} +$has_brotli = "{$colorYellow}no{$colorReset}"; +if (extension_loaded('brotli')) { + $has_brotli = "{$colorGreen}yes{$colorReset}"; +} $has_jsond = "{$colorYellow}no{$colorReset}"; $has_jsond_as_json = "{$colorYellow}no{$colorReset}"; @@ -1579,6 +1621,7 @@ function print_results_common() global $line, $padHeader, $cpuInfo, $padInfo, $scriptVersion, $maxTime, $originTimeLimit, $originMemoryLimit, $cryptAlgoName, $memoryLimitMb; global $flushStr, $has_apc, $has_pcre, $has_intl, $has_json, $has_simplexml, $has_dom, $has_mbstring, $has_opcache, $has_xcache; global $has_gd, $has_imagick, $has_igb, $has_msg, $has_jsond, $has_jsond_as_json; + global $has_zlib, $has_bz2, $has_lz4, $has_zstd, $has_brotli; global $opcache, $has_eacc, $has_xdebug, $xcache, $apcache, $eaccel, $xdebug, $xdbg_mode, $obd_set, $mbover; global $showOnlySystemInfo, $padLabel, $functions, $runOnlySelectedTests, $selectedTests, $totalOps; global $colorGreen, $colorReset, $colorRed; @@ -1620,6 +1663,12 @@ function print_results_common() . str_pad("msgpack", $padInfo, ' ', STR_PAD_LEFT) . " : $has_msg\n" . str_pad("jsond", $padInfo, ' ', STR_PAD_LEFT) . " : $has_jsond\n" . str_pad("jsond as json>>", $padInfo, ' ', STR_PAD_LEFT) . " : $has_jsond_as_json\n" + . str_pad("-compression->", $padInfo, ' ', STR_PAD_LEFT) . "\n" + . str_pad("zlib", $padInfo, ' ', STR_PAD_LEFT) . " : $has_zlib\n" + . str_pad("bz2", $padInfo, ' ', STR_PAD_LEFT) . " : $has_bz2\n" + . str_pad("lz4", $padInfo, ' ', STR_PAD_LEFT) . " : $has_lz4\n" + . str_pad("zstd", $padInfo, ' ', STR_PAD_LEFT) . " : $has_zstd\n" + . str_pad("brotli", $padInfo, ' ', STR_PAD_LEFT) . " : $has_brotli\n" . str_pad("-affecting->", $padInfo, ' ', STR_PAD_LEFT) . "\n" . str_pad("opcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_opcache; enabled: {$opcache}\n" . str_pad("xcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_xcache; enabled: {$xcache}\n" diff --git a/compression.inc b/compression.inc new file mode 100644 index 0000000..7a35ff8 --- /dev/null +++ b/compression.inc @@ -0,0 +1,109 @@ + Date: 2023年9月14日 09:23:32 +0300 Subject: [PATCH 06/18] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.?= =?UTF-8?q?0.56?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae9716e..9b8b481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # ChangeLog -@ 2023年06月05日, v1.0.55 +@ 2023年09月14日, v1.0.56 + + * Добавлены тесты методов сжатия: zlib, bz2, lz4, zstd, brotli + +@ 2023年09月14日, v1.0.55 * Добавлены тесты msgpack -@ 2023年06月05日, v1.0.54 +@ 2023年09月14日, v1.0.54 * Добавлены тесты igbinary From e76e957ed3f347234fc9a0e26a72088e562a04d4 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: 2023年9月22日 23:23:39 +0300 Subject: [PATCH 07/18] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.?= =?UTF-8?q?0.57=20-=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20gd=20+=20imagick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++ README.en.md | 18 +++++++++++-- README.md | 18 +++++++++++-- bench.php | 37 ++++++++++++++++++++------ php-gd-imagick-common.inc | 31 ++++++++++++++++++++++ php-gd.inc | 53 +++++++++++++++++++++++++++++++++++++ php-imagick.inc | 55 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 204 insertions(+), 12 deletions(-) create mode 100644 php-gd-imagick-common.inc create mode 100644 php-gd.inc create mode 100644 php-imagick.inc diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b8b481..41359cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +@ 2023年09月22日, v1.0.57 + + * Добавлены тесты gd & imagick - ктобыстрее рисует простой qrcode + @ 2023年09月14日, v1.0.56 * Добавлены тесты методов сжатия: zlib, bz2, lz4, zstd, brotli diff --git a/README.en.md b/README.en.md index 2206049..cc6b416 100644 --- a/README.en.md +++ b/README.en.md @@ -12,6 +12,15 @@ Required modules for full php testing: - dom - simplexml - intl +- optional: + - gd + - imagick + - zlib + - bz2 + - brotli + - zstd + - igbinary + - msgpack Usually they are already installed or "compiled" in php. @@ -30,7 +39,7 @@ How to check it: ### 0. Files -You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `compression.inc`, `test.xml`. +You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `compression.inc`, `php-gd-imagick-common.inc`, `php-gd.inc`, `php-imagick.inc`, `test.xml`. ### 1. Through the console @@ -137,7 +146,7 @@ CPU : cores : 4 available : 4 MHz : 3600 MHz -Benchmark version : 1.0.56 +Benchmark version : 1.0.57 PHP version : 7.4.29-SergeyD/6.1 PHP time limit : 0 sec Setup time limit : 600 sec @@ -152,6 +161,9 @@ Crypt hash algo : MD5 simplexml : yes; libxml version: 2.9.4 dom : yes intl : yes; icu version: 66.1 + -optional-> + gd : yes: version: 2.2.5 + imagick : yes: version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org -alternative-> igbinary : yes msgpack : yes @@ -220,6 +232,8 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz | 31_intl_message_format : 4.236 sec | 47.22 kOp/s | 12.46 Ops/MHz | 4 Mb 32_intl_calendar : 0.844 sec | 355.34 kOp/s | 93.79 Ops/MHz | 4 Mb 33_phpinfo_generate : 1.440 sec | 6.95 kOp/s | 1.83 Ops/MHz | 4 Mb +34_gd_qrcode : 0.923 sec | 1.08 kOp/s | 0.30 Ops/MHz | 4 Mb +35_imagick_qrcode : 2.839 sec | 352.18 Op/s | 0.10 Ops/MHz | 4 Mb 36_brotli_compress : 5.012 sec | 199.50 kOp/s | 51.47 Ops/MHz | 3 Mb 36_bzip2_compress : 22.065 sec | 22.66 kOp/s | 5.85 Ops/MHz | 3 Mb 36_gzip_compress : 52.977 sec | 94.38 kOp/s | 24.35 Ops/MHz | 3 Mb diff --git a/README.md b/README.md index 8788564..fece02e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,15 @@ - dom - simplexml - intl +- optional: + - gd + - imagick + - brotli + - zlib + - bz2 + - zstd + - igbinary + - msgpack Обычно они уже установлены или "вкомпилированны" в php. @@ -30,7 +39,7 @@ ### 0. Файлы -Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `compression.inc`, `test.xml`. +Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `compression.inc`, `php-gd-imagick-common.inc`, `php-gd.inc`, `php-imagick.inc`, `test.xml`. ### 1. Через консоль @@ -138,7 +147,7 @@ CPU : cores : 4 available : 4 MHz : 3600 MHz -Benchmark version : 1.0.56 +Benchmark version : 1.0.57 PHP version : 7.4.29-SergeyD/6.1 PHP time limit : 0 sec Setup time limit : 600 sec @@ -153,6 +162,9 @@ Crypt hash algo : MD5 simplexml : yes; libxml version: 2.9.4 dom : yes intl : yes; icu version: 66.1 + -optional-> + gd : yes: version: 2.2.5 + imagick : yes: version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org -alternative-> igbinary : yes msgpack : yes @@ -221,6 +233,8 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz | 31_intl_message_format : 4.236 sec | 47.22 kOp/s | 12.46 Ops/MHz | 4 Mb 32_intl_calendar : 0.844 sec | 355.34 kOp/s | 93.79 Ops/MHz | 4 Mb 33_phpinfo_generate : 1.440 sec | 6.95 kOp/s | 1.83 Ops/MHz | 4 Mb +34_gd_qrcode : 0.923 sec | 1.08 kOp/s | 0.30 Ops/MHz | 4 Mb +35_imagick_qrcode : 2.839 sec | 352.18 Op/s | 0.10 Ops/MHz | 4 Mb 36_brotli_compress : 5.012 sec | 199.50 kOp/s | 51.47 Ops/MHz | 3 Mb 36_bzip2_compress : 22.065 sec | 22.66 kOp/s | 5.85 Ops/MHz | 3 Mb 36_gzip_compress : 52.977 sec | 94.38 kOp/s | 24.35 Ops/MHz | 3 Mb diff --git a/bench.php b/bench.php index e54491a..816ce79 100644 --- a/bench.php +++ b/bench.php @@ -9,8 +9,8 @@ # Company : Code24 BV, The Netherlands # # Author : Sergey Dryabzhinsky # # Company : Rusoft Ltd, Russia # -# Date : Jun 05, 2023 # -# Version : 1.0.56 # +# Date : Sep 22, 2023 # +# Version : 1.0.57 # # License : Creative Commons CC-BY license # # Website : https://github.com/rusoft/php-simple-benchmark-script # # Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script # @@ -18,7 +18,7 @@ ################################################################################ */ -$scriptVersion = '1.0.56'; +$scriptVersion = '1.0.57'; // Special string to flush buffers, nginx for example $flushStr = ''; @@ -88,6 +88,14 @@ if (extension_loaded('brotli')) { @include_once("compression.inc"); } +if (extension_loaded('gd')) { + @include_once("php-gd-imagick-common.inc"); + @include_once("php-gd.inc"); +} +if (extension_loaded('imagick')) { + @include_once("php-gd-imagick-common.inc"); + @include_once("php-imagick.inc"); +} $originMemoryLimit = @ini_get('memory_limit'); $originTimeLimit = @ini_get('max_execution_time'); @@ -705,8 +713,8 @@ function gethostname() { '31_intl_message_format' => 200000, '32_intl_calendar' => 300000, '33_phpinfo_generate' => 10000, - '34_gd_qrcode' => 700, - '35_imagick_qrcode' => 200, + '34_gd_qrcode' => 1000, + '35_imagick_qrcode' => 1000, '36_zlib_compress' => 5000000, '36_gzip_compress' => 5000000, '36_bzip2_compress' => 500000, @@ -1550,10 +1558,18 @@ function format_result_test($diffSeconds, $opCount, $memory = 0) $has_gd = "{$colorYellow}no{$colorReset}"; if (extension_loaded('gd')) { $has_gd = "{$colorGreen}yes{$colorReset}"; + $info = gd_info(); + define("GD_VERSION",$info["GD Version"]); +} else { + define("GD_VERSION","-.-.-"); } $has_imagick = "{$colorYellow}no{$colorReset}"; if (extension_loaded('imagick')) { $has_imagick = "{$colorGreen}yes{$colorReset}"; + $imv = Imagick::getVersion(); + define("IMG_VERSION", $imv["versionString"]); +} else { + define("IMG_VERSION", "-.-.-"); } $has_xdebug = "{$colorGreen}no{$colorReset}"; if (extension_loaded('xdebug')) { @@ -1581,8 +1597,12 @@ function format_result_test($diffSeconds, $opCount, $memory = 0) $has_intl = "{$colorGreen}yes{$colorReset}"; } $has_zlib = "{$colorYellow}no{$colorReset}"; +$has_gzip = "{$colorYellow}no{$colorReset}"; if (extension_loaded('zlib')) { $has_zlib = "{$colorGreen}yes{$colorReset}"; + if(function_exists('gzencode')) { + $has_gzip = "{$colorGreen}yes{$colorReset}"; + } } $has_bz2 = "{$colorYellow}no{$colorReset}"; if (extension_loaded('bz2')) { @@ -1621,7 +1641,7 @@ function print_results_common() global $line, $padHeader, $cpuInfo, $padInfo, $scriptVersion, $maxTime, $originTimeLimit, $originMemoryLimit, $cryptAlgoName, $memoryLimitMb; global $flushStr, $has_apc, $has_pcre, $has_intl, $has_json, $has_simplexml, $has_dom, $has_mbstring, $has_opcache, $has_xcache; global $has_gd, $has_imagick, $has_igb, $has_msg, $has_jsond, $has_jsond_as_json; - global $has_zlib, $has_bz2, $has_lz4, $has_zstd, $has_brotli; + global $has_zlib, $has_gzip, $has_bz2, $has_lz4, $has_zstd, $has_brotli; global $opcache, $has_eacc, $has_xdebug, $xcache, $apcache, $eaccel, $xdebug, $xdbg_mode, $obd_set, $mbover; global $showOnlySystemInfo, $padLabel, $functions, $runOnlySelectedTests, $selectedTests, $totalOps; global $colorGreen, $colorReset, $colorRed; @@ -1656,8 +1676,8 @@ function print_results_common() . str_pad("dom", $padInfo, ' ', STR_PAD_LEFT) . " : $has_dom\n" . str_pad("intl", $padInfo, ' ', STR_PAD_LEFT) . " : $has_intl" . ($has_intl == "{$colorGreen}yes{$colorReset}" ? '; icu version: ' . INTL_ICU_VERSION : '')."\n" . str_pad("-optional->", $padInfo, ' ', STR_PAD_LEFT) . "\n" - . str_pad("gd", $padInfo, ' ', STR_PAD_LEFT) . " : $has_gd\n" - . str_pad("imagick", $padInfo, ' ', STR_PAD_LEFT) . " : $has_imagick\n" + . str_pad("gd", $padInfo, ' ', STR_PAD_LEFT) . " : $has_gd: version: ". GD_VERSION."\n" + . str_pad("imagick", $padInfo, ' ', STR_PAD_LEFT) . " : $has_imagick: version: ".IMG_VERSION."\n" . str_pad("-alternative->", $padInfo, ' ', STR_PAD_LEFT) . "\n" . str_pad("igbinary", $padInfo, ' ', STR_PAD_LEFT) . " : $has_igb\n" . str_pad("msgpack", $padInfo, ' ', STR_PAD_LEFT) . " : $has_msg\n" @@ -1665,6 +1685,7 @@ function print_results_common() . str_pad("jsond as json>>", $padInfo, ' ', STR_PAD_LEFT) . " : $has_jsond_as_json\n" . str_pad("-compression->", $padInfo, ' ', STR_PAD_LEFT) . "\n" . str_pad("zlib", $padInfo, ' ', STR_PAD_LEFT) . " : $has_zlib\n" + . str_pad("gzip", $padInfo, ' ', STR_PAD_LEFT) . " : $has_gzip\n" . str_pad("bz2", $padInfo, ' ', STR_PAD_LEFT) . " : $has_bz2\n" . str_pad("lz4", $padInfo, ' ', STR_PAD_LEFT) . " : $has_lz4\n" . str_pad("zstd", $padInfo, ' ', STR_PAD_LEFT) . " : $has_zstd\n" diff --git a/php-gd-imagick-common.inc b/php-gd-imagick-common.inc new file mode 100644 index 0000000..883f952 --- /dev/null +++ b/php-gd-imagick-common.inc @@ -0,0 +1,31 @@ +newImage($imgW, $imgH, $col[0]); + + $image->setCompressionQuality($q); + $image->setImageFormat('jpeg'); + + $draw = new ImagickDraw(); + $draw->setFillColor($col[1]); + + // Loop over all dots and draw them: + for ($y = 0, $i = 0; $y < $size; $y++) { + for ($x = 0; $x < $size; $x++, $i++) { + if ($qr[$i] == '1') { // Draw a dot? + $draw->point($x,$y); + } + } + } + + $image->drawImage($draw); + $image->borderImage($col[0],$outerFrame,$outerFrame); + $image->scaleImage( $imgW * $pixelPerPoint, 0 ); + + // Save the result +// $image->writeImages("test-im.jpg",true); + $image->writeImages("/dev/null",true); + } + + $totalOps += $count; + return format_result_test(get_microtime() - $time_start, $count, mymemory_usage()); +} From a2afb7b593a65402f6de8343ba5b1659d0592d54 Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 14:34:24 -0300 Subject: [PATCH 08/18] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index fece02e..c973000 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ +# Run in Docker example: + +``` +docker run -it --rm \ + -v $PWD:/var/www/html \ + clearlinux/php-fpm \ + php -dopcache.enable_cli=0 /var/www/html/bench.php +``` + # Простой скрипт проверки быстродействия PHP Работает со всеми версиями ПХП: от 4.3 до 8.2 From bb047ee1a022a22271f56aff3d4cb251607aadbc Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 14:42:23 -0300 Subject: [PATCH 09/18] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index c973000..06bf0e4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ # Run in Docker example: ``` +# With Official PHP Docker image: +docker run -it --rm \ + --name bench-script \ + -v "$PWD":/usr/src/myapp \ + -w /usr/src/myapp \ + php:8.2-cli \ + php -dopcache.enable_cli=0 bench.php + +# Or... with ClearLinux php-fpm image: + docker run -it --rm \ -v $PWD:/var/www/html \ clearlinux/php-fpm \ From a9fd7e87768dd373d8f4395c03c52d630555e8d7 Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 14:44:04 -0300 Subject: [PATCH 10/18] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 06bf0e4..829f058 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Run in Docker example: ``` +git clone https://github.com/bgeneto/php-simple-benchmark-script.git +cd php-simple-benchmark-script/ + # With Official PHP Docker image: docker run -it --rm \ --name bench-script \ From d131d7e668d6fa68c965e178f5162a880f667864 Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 14:53:16 -0300 Subject: [PATCH 11/18] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 829f058..b84a291 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,17 @@ docker run -it --rm \ clearlinux/php-fpm \ php -dopcache.enable_cli=0 /var/www/html/bench.php ``` +# Run the sergix44 script in Docker instead + +``` +#https://github.com/sergix44/php-benchmark-script +docker run -it --rm \ + --name bench-script \ + -v "$PWD":/usr/src/myapp \ + -w /usr/src/myapp \ + php:8.2-cli \ + curl https://raw.githubusercontent.com/SergiX44/php-benchmark-script/master/bench.php | php -dopcache.enable_cli=0 +``` # Простой скрипт проверки быстродействия PHP From b31de945cc9870990a1f37a11945ff818aa4395e Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 15:28:49 -0300 Subject: [PATCH 12/18] Create phoronix-phpbench-install.sh --- phoronix-phpbench-install.sh | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 phoronix-phpbench-install.sh diff --git a/phoronix-phpbench-install.sh b/phoronix-phpbench-install.sh new file mode 100644 index 0000000..664131f --- /dev/null +++ b/phoronix-phpbench-install.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +tar -zxvf phpbench-0.8.1.tar.gz +cd phpbench-0.8.1 + +patch -p1 << 'EOF' +--- a/phpbench.php ++++ b/phpbench.php +@@ -1,6 +1,6 @@ + #! /usr/bin/env php + Date: 2024年3月13日 15:31:40 -0300 Subject: [PATCH 13/18] Update README.md --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b84a291..8e57826 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Run in Docker example: -``` +```bash git clone https://github.com/bgeneto/php-simple-benchmark-script.git cd php-simple-benchmark-script/ @@ -21,7 +21,7 @@ docker run -it --rm \ ``` # Run the sergix44 script in Docker instead -``` +```bash #https://github.com/sergix44/php-benchmark-script docker run -it --rm \ --name bench-script \ @@ -30,6 +30,21 @@ docker run -it --rm \ php:8.2-cli \ curl https://raw.githubusercontent.com/SergiX44/php-benchmark-script/master/bench.php | php -dopcache.enable_cli=0 ``` +# Run phoronix phpbench test: + +```bash +wget https://download.pureftpd.org/pub/phpbench/phpbench-0.8.1.tar.gz +wget https://raw.githubusercontent.com/bgeneto/php-simple-benchmark-script/master/phoronix-phpbench-install.sh +chmod +x ./phoronix-phpbench-install.sh +./phoronix-phpbench-install.sh +cd phpbench-0.8.1/ +docker run -it --rm \ + --name bench-script \ + -v "$PWD":/usr/src/myapp \ + -w /usr/src/myapp \ + php:8.2-cli \ + php -dopcache.enable_cli=0 phpbench.php -i 1000000 +``` # Простой скрипт проверки быстродействия PHP From 32e9c6a1248b58be4eafb0e00a1493b574cbd01d Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 15:39:34 -0300 Subject: [PATCH 14/18] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8e57826..b6bc2ce 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,9 @@ docker run -it --rm \ # Run phoronix phpbench test: ```bash -wget https://download.pureftpd.org/pub/phpbench/phpbench-0.8.1.tar.gz -wget https://raw.githubusercontent.com/bgeneto/php-simple-benchmark-script/master/phoronix-phpbench-install.sh -chmod +x ./phoronix-phpbench-install.sh -./phoronix-phpbench-install.sh -cd phpbench-0.8.1/ +wget https://phoronix-test-suite.com/benchmark-files/phpbench-081-patched1.zip +unzip phpbench-081-patched1.zip +cd phpbench-0.8.1-patched1/ docker run -it --rm \ --name bench-script \ -v "$PWD":/usr/src/myapp \ From c9f72ee57c50ec624d682baee4e65c6735b78fbc Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月13日 15:47:08 -0300 Subject: [PATCH 15/18] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b6bc2ce..3643088 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ docker run -it --rm \ # Run phoronix phpbench test: ```bash -wget https://phoronix-test-suite.com/benchmark-files/phpbench-081-patched1.zip -unzip phpbench-081-patched1.zip -cd phpbench-0.8.1-patched1/ +wget https://phoronix-test-suite.com/benchmark-files/phpbench-081-patched2.zip +unzip ./phpbench-081-patched2.zip +cd ./phpbench-081-patched2/ docker run -it --rm \ --name bench-script \ -v "$PWD":/usr/src/myapp \ From f72da78d0136aa04e977b45500e70a271dedff52 Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月15日 02:38:15 -0300 Subject: [PATCH 16/18] Update bench.php --- bench.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bench.php b/bench.php index 816ce79..4000f0a 100644 --- a/bench.php +++ b/bench.php @@ -651,6 +651,7 @@ function gethostname() { '8.0' => 83, '8.1' => 82, '8.2' => 79, + '8.3' => 78, ); // Simple and fast test times, used to adjust all test times and limits $dumbTestMaxPhpTimes = array( @@ -668,6 +669,7 @@ function gethostname() { '8.0' => 0.324, '8.1' => 0.323, '8.2' => 0.294, + '8.3' => 0.293, ); // Nice dice roll // Should not be longer than 600 seconds From b5cf5a408561422c794ce4e16a2a750ce5f14e74 Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年3月15日 02:45:46 -0300 Subject: [PATCH 17/18] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3643088..8b2eab4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Run in Docker example: +# Run via Docker: ```bash git clone https://github.com/bgeneto/php-simple-benchmark-script.git @@ -30,7 +30,7 @@ docker run -it --rm \ php:8.2-cli \ curl https://raw.githubusercontent.com/SergiX44/php-benchmark-script/master/bench.php | php -dopcache.enable_cli=0 ``` -# Run phoronix phpbench test: +# Run phoronix phpbench (not working): ```bash wget https://phoronix-test-suite.com/benchmark-files/phpbench-081-patched2.zip From a49c12beb4a1babfab116249e48852ba7d5c75ab Mon Sep 17 00:00:00 2001 From: Bernhard Enders Date: 2024年10月26日 13:48:02 -0300 Subject: [PATCH 18/18] Update README.md --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 8b2eab4..0ba5bbe 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,8 @@ docker run -it --rm \ --name bench-script \ -v "$PWD":/usr/src/myapp \ -w /usr/src/myapp \ - php:8.2-cli \ + php:8.3-cli \ php -dopcache.enable_cli=0 bench.php - -# Or... with ClearLinux php-fpm image: - -docker run -it --rm \ - -v $PWD:/var/www/html \ - clearlinux/php-fpm \ - php -dopcache.enable_cli=0 /var/www/html/bench.php ``` # Run the sergix44 script in Docker instead

AltStyle によって変換されたページ (->オリジナル) /