forked from rusoft/php-simple-benchmark-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php7.inc
32 lines (27 loc) · 733 Bytes
/
php7.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* PHP 7.x only functions tests
*/
function test_22_Loop_Null_Op()
{
global $testsLoopLimits, $totalOps;
$a = array(0 => 0, 2 => 2, 4 => 4);
$count = $testsLoopLimits['22_loop_nullop'];
$time_start = get_microtime();
for ($i = 0; $i < $count; $i++) {
$r = $a[$i % 2] ?? 0;
}
$totalOps += $count;
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
}
function test_23_Loop_Spaceship_Op()
{
global $testsLoopLimits, $totalOps;
$count = $testsLoopLimits['23_loop_spaceship'];
$time_start = get_microtime();
for ($i = 0; $i < $count; $i++) {
$r = $i % 5 <=> 2;
}
$totalOps += $count;
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
}