Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c658860

Browse files
Добавил тестирование msgpack - версияя 1.0.55
1 parent b26e3cc commit c658860

File tree

5 files changed

+135
-6
lines changed

5 files changed

+135
-6
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog
22

3+
@ 2023年06月05日, v1.0.55
4+
5+
* Добавлены тесты msgpack
6+
37
@ 2023年06月05日, v1.0.54
48

59
* Добавлены тесты igbinary

‎README.en.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ How to check it:
3030

3131
### 0. Files
3232

33-
You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `test.xml`.
33+
You need to put these files in one directory: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `test.xml`.
3434

3535
### 1. Through the console
3636

@@ -152,6 +152,11 @@ Crypt hash algo : MD5
152152
simplexml : yes; libxml version: 2.9.4
153153
dom : yes
154154
intl : yes; icu version: 66.1
155+
-alternative->
156+
igbinary : yes
157+
msgpack : yes
158+
jsond : yes
159+
jsond as json >> : yes
155160
-affecting->
156161
opcache : yes; enabled: 0
157162
xcache : no; enabled: 0
@@ -176,6 +181,12 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz |
176181
08_2_crypt : 8.698 sec | 1.15 kOp/s | 0.30 Ops/MHz | 4 Mb
177182
09_json_encode : 2.322 sec | 559.91 kOp/s | 147.78 Ops/MHz | 4 Mb
178183
10_json_decode : 3.556 sec | 365.54 kOp/s | 96.48 Ops/MHz | 4 Mb
184+
11_igb_serialize : 2.894 sec | 449.19 kOp/s | 124.78 Ops/MHz | 3 Mb
185+
11_msgpack_pack : 2.054 sec | 633.01 kOp/s | 175.84 Ops/MHz | 3 Mb
186+
11_serialize : 3.727 sec | 348.79 kOp/s | 96.89 Ops/MHz | 3 Mb
187+
12_igb_unserialize : 2.123 sec | 612.31 kOp/s | 170.09 Ops/MHz | 3 Mb
188+
12_msgpack_unpack : 2.657 sec | 489.30 kOp/s | 135.92 Ops/MHz | 3 Mb
189+
12_unserialize : 3.226 sec | 402.91 kOp/s | 111.92 Ops/MHz | 3 Mb
179190
11_serialize : 1.551 sec | 838.30 kOp/s | 221.25 Ops/MHz | 4 Mb
180191
12_unserialize : 1.677 sec | 774.97 kOp/s | 204.54 Ops/MHz | 4 Mb
181192
13_array_fill : 3.740 sec | 24.07 MOp/s | 6.35 kOps/MHz | 24 Mb

‎README.md‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
### 0. Файлы
3232

33-
Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `test.xml`.
33+
Нужно положить в один каталог файлы: `bench.php`, `common.inc`, `php5.inc`, `php7.inc`, `igbinary.inc`, `msgpack.inc`, `test.xml`.
3434

3535
### 1. Через консоль
3636

@@ -138,7 +138,7 @@ CPU :
138138
cores : 4
139139
available : 4
140140
MHz : 3600 MHz
141-
Benchmark version : 1.0.47
141+
Benchmark version : 1.0.55
142142
PHP version : 7.4.29-SergeyD/6.1
143143
PHP time limit : 0 sec
144144
Setup time limit : 600 sec
@@ -153,6 +153,11 @@ Crypt hash algo : MD5
153153
simplexml : yes; libxml version: 2.9.4
154154
dom : yes
155155
intl : yes; icu version: 66.1
156+
-alternative->
157+
igbinary : yes
158+
msgpack : yes
159+
jsond : yes
160+
jsond as json >> : yes
156161
-affecting->
157162
opcache : yes; enabled: 0
158163
xcache : no; enabled: 0
@@ -177,6 +182,12 @@ TEST NAME : SECONDS | OP/SEC | OP/SEC/MHz |
177182
08_2_crypt : 8.698 sec | 1.15 kOp/s | 0.30 Ops/MHz | 4 Mb
178183
09_json_encode : 2.322 sec | 559.91 kOp/s | 147.78 Ops/MHz | 4 Mb
179184
10_json_decode : 3.556 sec | 365.54 kOp/s | 96.48 Ops/MHz | 4 Mb
185+
11_igb_serialize : 2.894 sec | 449.19 kOp/s | 124.78 Ops/MHz | 3 Mb
186+
11_msgpack_pack : 2.054 sec | 633.01 kOp/s | 175.84 Ops/MHz | 3 Mb
187+
11_serialize : 3.727 sec | 348.79 kOp/s | 96.89 Ops/MHz | 3 Mb
188+
12_igb_unserialize : 2.123 sec | 612.31 kOp/s | 170.09 Ops/MHz | 3 Mb
189+
12_msgpack_unpack : 2.657 sec | 489.30 kOp/s | 135.92 Ops/MHz | 3 Mb
190+
12_unserialize : 3.226 sec | 402.91 kOp/s | 111.92 Ops/MHz | 3 Mb
180191
11_serialize : 1.551 sec | 838.30 kOp/s | 221.25 Ops/MHz | 4 Mb
181192
12_unserialize : 1.677 sec | 774.97 kOp/s | 204.54 Ops/MHz | 4 Mb
182193
13_array_fill : 3.740 sec | 24.07 MOp/s | 6.35 kOps/MHz | 24 Mb

‎bench.php‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
# Author : Sergey Dryabzhinsky #
1111
# Company : Rusoft Ltd, Russia #
1212
# Date : Jun 05, 2023 #
13-
# Version : 1.0.54 #
13+
# Version : 1.0.55 #
1414
# License : Creative Commons CC-BY license #
1515
# Website : https://github.com/rusoft/php-simple-benchmark-script #
1616
# Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script #
1717
# #
1818
################################################################################
1919
*/
2020

21-
$scriptVersion = '1.0.54';
21+
$scriptVersion = '1.0.55';
2222

2323
// Special string to flush buffers, nginx for example
2424
$flushStr = '<!-- '.str_repeat("", 8192).' -->';
@@ -73,6 +73,12 @@
7373
@include("igbinary.inc");
7474
}
7575

76+
$has_msg = "{$colorYellow}no{$colorReset}";
77+
if (extension_loaded('msgpack')) {
78+
$has_msg = "{$colorGreen}yes{$colorReset}";
79+
@include("msgpack.inc");
80+
}
81+
7682
$originMemoryLimit = @ini_get('memory_limit');
7783
$originTimeLimit = @ini_get('max_execution_time');
7884

@@ -665,6 +671,8 @@ function gethostname() {
665671
'12_unserialize' => 1300000,
666672
'11_igb_serialize' => 1300000,
667673
'12_igb_unserialize' => 1300000,
674+
'11_msgpack_pack' => 1300000,
675+
'12_msgpack_unpack' => 1300000,
668676
'13_array_loop' => 250,
669677
'14_array_loop' => 250,
670678
'15_clean_loops' => 200000000,
@@ -1551,6 +1559,15 @@ function format_result_test($diffSeconds, $opCount, $memory = 0)
15511559
$has_intl = "{$colorGreen}yes{$colorReset}";
15521560
}
15531561

1562+
$has_jsond = "{$colorYellow}no{$colorReset}";
1563+
$has_jsond_as_json = "{$colorYellow}no{$colorReset}";
1564+
if ($jsond = extension_loaded('jsond')) {
1565+
$has_jsond = "{$colorGreen}yes{$colorReset}";
1566+
}
1567+
if ($jsond && !function_exists('jsond_encode')) {
1568+
$has_jsond_as_json = "{$colorGreen}yes{$colorReset}";
1569+
}
1570+
15541571
if (!defined('PCRE_VERSION')) define('PCRE_VERSION', '-.--');
15551572
if (!defined('LIBXML_DOTTED_VERSION')) define('LIBXML_DOTTED_VERSION', '-.-.-');
15561573
if (!defined('INTL_ICU_VERSION')) define('INTL_ICU_VERSION', '-.-');
@@ -1561,7 +1578,7 @@ function print_results_common()
15611578

15621579
global $line, $padHeader, $cpuInfo, $padInfo, $scriptVersion, $maxTime, $originTimeLimit, $originMemoryLimit, $cryptAlgoName, $memoryLimitMb;
15631580
global $flushStr, $has_apc, $has_pcre, $has_intl, $has_json, $has_simplexml, $has_dom, $has_mbstring, $has_opcache, $has_xcache;
1564-
global $has_gd, $has_imagick, $has_igb;
1581+
global $has_gd, $has_imagick, $has_igb, $has_msg, $has_jsond, $has_jsond_as_json;
15651582
global $opcache, $has_eacc, $has_xdebug, $xcache, $apcache, $eaccel, $xdebug, $xdbg_mode, $obd_set, $mbover;
15661583
global $showOnlySystemInfo, $padLabel, $functions, $runOnlySelectedTests, $selectedTests, $totalOps;
15671584
global $colorGreen, $colorReset, $colorRed;
@@ -1600,6 +1617,9 @@ function print_results_common()
16001617
. str_pad("imagick", $padInfo, '', STR_PAD_LEFT) . " : $has_imagick\n"
16011618
. str_pad("-alternative->", $padInfo, '', STR_PAD_LEFT) . "\n"
16021619
. str_pad("igbinary", $padInfo, '', STR_PAD_LEFT) . " : $has_igb\n"
1620+
. str_pad("msgpack", $padInfo, '', STR_PAD_LEFT) . " : $has_msg\n"
1621+
. str_pad("jsond", $padInfo, '', STR_PAD_LEFT) . " : $has_jsond\n"
1622+
. str_pad("jsond as json >>", $padInfo, '', STR_PAD_LEFT) . " : $has_jsond_as_json\n"
16031623
. str_pad("-affecting->", $padInfo, '', STR_PAD_LEFT) . "\n"
16041624
. str_pad("opcache", $padInfo, '', STR_PAD_LEFT) . " : $has_opcache; enabled: {$opcache}\n"
16051625
. str_pad("xcache", $padInfo, '', STR_PAD_LEFT) . " : $has_xcache; enabled: {$xcache}\n"

‎msgpack.inc‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/**
3+
* Common php test functions
4+
* Php 4.4+
5+
*/
6+
7+
/** ---------------------------------- Tests functions -------------------------------------------- */
8+
9+
function test_11_msgpack_pack()
10+
{
11+
global $stringTest, $emptyResult, $testsLoopLimits, $totalOps;
12+
13+
if (!function_exists('msgpack_pack')) {
14+
return $emptyResult;
15+
}
16+
17+
$data = array(
18+
$stringTest,
19+
123456,
20+
123.456,
21+
array(123456),
22+
null,
23+
false,
24+
);
25+
$obj = new stdClass();
26+
$obj->fieldStr = 'value';
27+
$obj->fieldInt = 123456;
28+
$obj->fieldFloat = 123.456;
29+
$obj->fieldArray = array(123456);
30+
$obj->fieldNull = null;
31+
$obj->fieldBool = false;
32+
$data[] = $obj;
33+
34+
$count = $testsLoopLimits['11_msgpack_pack'];
35+
$time_start = get_microtime();
36+
for ($i = 0; $i < $count; $i++) {
37+
foreach ($data as $value) {
38+
$r = msgpack_pack($value);
39+
}
40+
}
41+
$totalOps += $count;
42+
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
43+
}
44+
45+
function test_12_msgpack_unpack()
46+
{
47+
global $stringTest, $emptyResult, $testsLoopLimits, $totalOps;
48+
49+
if (!function_exists('msgpack_unpack')) {
50+
return $emptyResult;
51+
}
52+
53+
$data = array(
54+
$stringTest,
55+
123456,
56+
123.456,
57+
array(123456),
58+
null,
59+
false,
60+
);
61+
$obj = new stdClass();
62+
$obj->fieldStr = 'value';
63+
$obj->fieldInt = 123456;
64+
$obj->fieldFloat = 123.456;
65+
$obj->fieldArray = array(123456);
66+
$obj->fieldNull = null;
67+
$obj->fieldBool = false;
68+
$data[] = $obj;
69+
70+
foreach ($data as $key => $value) {
71+
$data[$key] = msgpack_pack($value);
72+
}
73+
74+
$count = $testsLoopLimits['12_msgpack_unpack'];
75+
$time_start = get_microtime();
76+
for ($i = 0; $i < $count; $i++) {
77+
foreach ($data as $value) {
78+
$r = msgpack_unpack($value);
79+
}
80+
}
81+
$totalOps += $count;
82+
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
83+
}

0 commit comments

Comments
(0)

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