Skip to content

Commit 6cc136c

Browse files
Version 1.0.65
Add simple tests for iconv, session Use only 1 shm entry for shmop
1 parent 39ccc0d commit 6cc136c

File tree

5 files changed

+97
-14
lines changed

5 files changed

+97
-14
lines changed

‎CHANGELOG.md

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

3+
@ 2025-06-07, v1.0.65
4+
5+
* Added simple test for session
6+
* Added simple test for iconv
7+
38
@ 2025-06-06, v1.0.64
49

510
* Added simple tests for sodium

‎bench.php

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# Company : Code24 BV, The Netherlands #
1010
# Author : Sergey Dryabzhinsky #
1111
# Company : Rusoft Ltd, Russia #
12-
# Date : Jun 6, 2025 #
13-
# Version : 1.0.64 #
12+
# Date : Jun 7, 2025 #
13+
# Version : 1.0.65 #
1414
# License : Creative Commons CC-BY license #
1515
# Website : https://github.com/rusoft/php-simple-benchmark-script #
1616
# Website : https://gitea.rusoft.ru/open-source/php-simple-benchmark-script #
@@ -20,7 +20,7 @@
2020

2121
include_once("php-options.php");
2222

23-
$scriptVersion = '1.0.64';
23+
$scriptVersion = '1.0.65';
2424

2525
// Special string to flush buffers, nginx for example
2626
$flushStr = '<!-- '.str_repeat(" ", 8192).' -->';
@@ -105,6 +105,12 @@
105105
if (extension_loaded('ctype')) {
106106
@include_once("mod-ctype-isdigit.inc");
107107
}
108+
if (extension_loaded('iconv')) {
109+
@include_once("mod-iconv.inc");
110+
}
111+
if (extension_loaded('session')) {
112+
@include_once("mod-session.inc");
113+
}
108114
if (file_exists('UUID.php') && PHP_VERSION >= '5.0.0') {
109115
@include_once("php-uuid.inc");
110116
}
@@ -728,7 +734,7 @@ function gethostname() {
728734
$loopMaxPhpTimesMHz = 3500;
729735
// How much time needed for tests on this machine
730736
$loopMaxPhpTimes = array(
731-
'4.4' => 1456,
737+
'4.4' => 2099,
732738
'5.2' => 839,
733739
'5.3' => 1235,
734740
'5.4' => 1510,
@@ -743,7 +749,7 @@ function gethostname() {
743749
'8.1' => 450,
744750
'8.2' => 427,
745751
'8.3' => 582,
746-
'8.4' => 736
752+
'8.4' => 529
747753
);
748754
// Simple and fast test times, used to adjust all test times and limits
749755
$dumbTestMaxPhpTimes = array(
@@ -838,6 +844,8 @@ function gethostname() {
838844
'41_01_sodium_string_num_int' => 10000000,
839845
'41_02_sodium_string_num_float' => 10000000,
840846
'42_ctype_isdigit' => 10000000,
847+
'43_iconv_translit' => 10000000,
848+
'44_session_time' => 100000,
841849
);
842850
// Should not be more than X Mb
843851
// Different PHP could use different amount of memory
@@ -913,6 +921,8 @@ function gethostname() {
913921
'41_01_sodium_string_num_int' => 4,
914922
'41_02_sodium_string_num_float' => 4,
915923
'42_ctype_isdigit' => 4,
924+
'43_iconv_translit' => 4,
925+
'44_session_time' => 4,
916926
);
917927

918928
/** ---------------------------------- Common functions -------------------------------------------- */
@@ -1820,6 +1830,14 @@ function filter_out_name_by_pattern($key)
18201830
if (extension_loaded('ctype')) {
18211831
$has_ctype = "{$colorGreen}yes{$colorReset}";
18221832
}
1833+
$has_iconv = "{$colorYellow}no{$colorReset}";
1834+
if (extension_loaded('iconv')) {
1835+
$has_iconv = "{$colorGreen}yes{$colorReset}";
1836+
}
1837+
$has_session = "{$colorYellow}no{$colorReset}";
1838+
if (extension_loaded('session')) {
1839+
$has_session = "{$colorGreen}yes{$colorReset}";
1840+
}
18231841
$has_zlib = "{$colorYellow}no{$colorReset}";
18241842
$has_gzip = "{$colorYellow}no{$colorReset}";
18251843
if (extension_loaded('zlib')) {
@@ -1864,10 +1882,10 @@ function filter_out_name_by_pattern($key)
18641882
}
18651883

18661884
if (!defined('PCRE_VERSION')) define('PCRE_VERSION', '-.--');
1867-
if (!defined('ZLIB_VERSION')) define('ZLIB_VERSION', '-.--');
1868-
if (!defined('MEMCACHE_VERSION')) define('MEMCACHE_VERSION', '-.--');
1869-
if (!defined('REDIS_VERSION')) define('REDIS_VERSION', '-.--');
1870-
if (!defined('SQLITE3_VERSION')) define('SQLITE3_VERSION', '-.--');
1885+
if (!defined('ZLIB_VERSION')) define('ZLIB_VERSION', '-.-.-');
1886+
if (!defined('MEMCACHE_VERSION')) define('MEMCACHE_VERSION', '-.-.-');
1887+
if (!defined('REDIS_VERSION')) define('REDIS_VERSION', '-.-.-');
1888+
if (!defined('SQLITE3_VERSION')) define('SQLITE3_VERSION', '-.-.-');
18711889
if (!defined('LIBXML_DOTTED_VERSION')) define('LIBXML_DOTTED_VERSION', '-.-.-');
18721890
if (!defined('SODIUM_LIBRARY_VERSION')) define('SODIUM_LIBRARY_VERSION', '-.-.-');
18731891
if (!defined('INTL_ICU_VERSION')) define('INTL_ICU_VERSION', '-.-');
@@ -1881,7 +1899,7 @@ function print_results_common()
18811899
global $line, $padHeader, $cpuInfo, $padInfo, $scriptVersion, $maxTime, $originTimeLimit, $originMemoryLimit, $cryptAlgoName, $memoryLimitMb;
18821900
global $flushStr, $has_apc, $has_pcre, $has_intl, $has_json, $has_simplexml, $has_dom, $has_mbstring, $has_opcache, $has_xcache;
18831901
global $has_gd, $has_gdgif, $has_gdpng, $has_gdjpg, $has_gdwebp, $has_gdavif;
1884-
global $has_imagick, $has_igb, $has_msg, $has_jsond, $has_jsond_as_json, $has_ctype;
1902+
global $has_imagick, $has_igb, $has_msg, $has_jsond, $has_jsond_as_json, $has_ctype, $has_iconv, $has_session;
18851903
global $has_zlib, $has_uuid, $has_gzip, $has_bz2, $has_lz4, $has_snappy, $has_zstd, $has_brotli;
18861904
global $has_apcu, $has_shmop, $has_memcache, $has_redis, $has_sodium, $has_sqlite3, $opcache, $has_eacc, $has_xdebug, $xcache, $apcache, $eaccel, $xdebug, $xdbg_mode, $obd_set, $mbover;
18871905
global $showOnlySystemInfo, $padLabel, $functions, $runOnlySelectedTests, $selectedTests, $totalOps;
@@ -1916,6 +1934,8 @@ function print_results_common()
19161934
. str_pad("simplexml", $padInfo, ' ', STR_PAD_LEFT) . " : $has_simplexml; libxml version: ".LIBXML_DOTTED_VERSION."\n"
19171935
. str_pad("dom", $padInfo, ' ', STR_PAD_LEFT) . " : $has_dom\n"
19181936
. str_pad("ctype", $padInfo, ' ', STR_PAD_LEFT) . " : $has_ctype\n"
1937+
. str_pad("iconv", $padInfo, ' ', STR_PAD_LEFT) . " : $has_iconv\n"
1938+
. str_pad("session", $padInfo, ' ', STR_PAD_LEFT) . " : $has_session\n"
19191939
. str_pad("intl", $padInfo, ' ', STR_PAD_LEFT) . " : $has_intl" . ($has_intl == "{$colorGreen}yes{$colorReset}" ? '; icu version: ' . INTL_ICU_VERSION : '')."\n"
19201940
. str_pad("-optional->", $padInfo, ' ', STR_PAD_LEFT) . "\n"
19211941
. str_pad("gd", $padInfo, ' ', STR_PAD_LEFT) . " : $has_gd: version: ". GD_VERSION."\n"
@@ -1926,7 +1946,7 @@ function print_results_common()
19261946
. str_pad("\t- AVIF", $padInfo, ' ', STR_PAD_LEFT) . " : $has_gdavif"."\n"
19271947
. str_pad("imagick", $padInfo, ' ', STR_PAD_LEFT) . " : $has_imagick: version: ".IMG_VERSION."\n"
19281948
. str_pad("apcu", $padInfo, ' ', STR_PAD_LEFT) . " : $has_apcu;\n"
1929-
. str_pad("shmop", $padInfo, ' ', STR_PAD_LEFT) . " : $has_shmop;\n"
1949+
. str_pad("shmop", $padInfo, ' ', STR_PAD_LEFT) . " : $has_shmop\n"
19301950
. str_pad("memcache", $padInfo, ' ', STR_PAD_LEFT) . " : $has_memcache, version: ".MEMCACHE_VERSION.";\n"
19311951
. str_pad("redis", $padInfo, ' ', STR_PAD_LEFT) . " : $has_redis, version: ".REDIS_VERSION.";\n"
19321952
. str_pad("sqlite3", $padInfo, ' ', STR_PAD_LEFT) . " : $has_sqlite3, version: ".SQLITE3_VERSION.";\n"

‎kvstorage-shmop.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class KVStorageShmop
2121
}
2222

2323
public function set($key, $value, $timeout=60){
24-
$id=shmop_open($key, "a", 0, 0);
24+
$id=shmop_open(1, "a", 0, 0);
2525
if ($id===false) return false;
2626
$ret=shmop_write($id, $value, 0);
2727
shmop_close($id);
2828
return $ret;
2929
}
3030

3131
public function get($key, $default=null){
32-
$id=shmop_open($key, "a", 0, 0);
32+
$id=shmop_open(1, "a", 0, 0);
3333
if ($id===false) return false;
3434
$size=shmop_size($id);
3535
$ret=shmop_read($id,0,$size);
@@ -38,7 +38,7 @@ class KVStorageShmop
3838
}
3939

4040
public function del($key){
41-
$id=shmop_open($key, "a", 0, 0);
41+
$id=shmop_open(1, "a", 0, 0);
4242
if ($id===false) return false;
4343
$ret=shmop_delete($id);
4444
shmop_close($id);

‎mod-iconv.inc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* module iconv test functions
4+
* Php 4.0
5+
*/
6+
7+
/** ---------------------------------- Tests functions -------------------------------------------- */
8+
9+
function test_43_iconv_translit()
10+
{
11+
global $stringTest, $emptyResult, $testsLoopLimits, $totalOps;
12+
13+
if (!function_exists('iconv')) {
14+
return $emptyResult;
15+
}
16+
17+
$count = $testsLoopLimits['43_iconv_translit'];
18+
$time_start = get_microtime();
19+
$text = "This is the Euro symbol 'â¬";
20+
$d=0;
21+
setlocale(LC_CTYPE, 'POSIX');
22+
for ($i = 0; $i < $count; $i++) {
23+
if (iconv("utf8", "ISO-8859-1//TRANSLIT", $text)) $d++;
24+
}
25+
$totalOps += $count;
26+
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
27+
}

‎mod-session.inc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* module session test functions
4+
* Php 4.0
5+
*/
6+
7+
/** ---------------------------------- Tests functions -------------------------------------------- */
8+
9+
function test_44_session_time()
10+
{
11+
global $stringTest, $emptyResult, $testsLoopLimits, $totalOps;
12+
13+
if (!function_exists('session_start')) {
14+
return $emptyResult;
15+
}
16+
if (!function_exists('session_destroy')) {
17+
return $emptyResult;
18+
}
19+
20+
$count = $testsLoopLimits['44_session_time'];
21+
$time_start = get_microtime();
22+
setlocale(LC_CTYPE, 'POSIX');
23+
for ($i = 0; $i < $count; $i++) {
24+
if (@session_start()){
25+
$SESSION['time']=get_microtime();
26+
session_destroy();
27+
}
28+
}
29+
$totalOps += $count;
30+
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
31+
}

0 commit comments

Comments
 (0)