-
Notifications
You must be signed in to change notification settings - Fork 1
/
bench.php
57 lines (47 loc) · 1.2 KB
/
bench.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* This file is part of the PHP-Performance-bench.
*
* (c) Nicolas Bastien <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require 'bench/array.php';
require 'bench/string.php';
require 'bench/variable.php';
require 'bench/test.php';
require 'bench/reference.php';
require 'bench/numeric.php';
require 'bench/error.php';
require 'bench/loop.php';
require 'bench/object.php';
bench_array();
bench_string();
bench_variable();
bench_test();
Bench\Reference\bench_reference();
bench_numeric();
bench_error();
bench_loop();
Bench\Object\bench_object();
function bench_skeleton($max)
{
echo 'Bench : skeleton' . PHP_EOL;
$value = 'test_value';
$startA = microtime(true);
for ($i = 0; $i <= $max; $i++) {
}
$endA = microtime(true);
echo ' A : ' . ($endA - $startA) .PHP_EOL;
$startB = microtime(true);
for ($i = 0; $i <= $max; $i++) {
}
$endB = microtime(true);
echo ' B : ' . ($endB - $startB) . PHP_EOL;
$startC = microtime(true);
for ($i = 0; $i <= $max; $i++) {
}
$endC = microtime(true);
echo ' C : ' . ($endC - $startC) . PHP_EOL;
}