/
benchmark.phpt
executable file
·61 lines (44 loc) · 1.21 KB
/
benchmark.phpt
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
58
59
60
61
--TEST--
SeasSnowflake testBenchmark
--FILE--
<?php
/*
$config=['worker_id'=>10,'datacenter_id'=>1];
$client = new SeasSnowflake($config);
echo "\nmake 100000 id=================\n";
$start = microtime(true);
for($i=0;$i<100000;$i++){
$id= $client->generate();
}
$end = (float)microtime(true);
echo 'cost:'.round($end-$start,6).' second ';
echo ' and memory usage: ' . memory_get_usage() . 'byte';
echo "\nmake 200000 id=================\n";
$start = microtime(true);
for($i=0;$i<200000;$i++){
$id= $client->generate();
}
$end = (float)microtime(true);
echo 'cost:'.round($end-$start,6).' second ';
echo ' and memory usage: ' . memory_get_usage() . 'byte';
echo "\nmake 300000 id=================\n";
$start = microtime(true);
for($i=0;$i<300000;$i++){
$id= $client->generate();
}
$end = (float)microtime(true);
echo 'cost:'.round($end-$start,6).' second ';
echo ' and memory usage: ' . memory_get_usage() . 'byte';
echo "\nmake 500000 id=================\n";
$start = microtime(true);
for($i=0;$i<300000;$i++){
$id= $client->generate();
}
$end = (float)microtime(true);
echo 'cost:'.round($end-$start,6).' second ';
echo ' and memory usage: ' . memory_get_usage() . 'byte';
*/
echo 1;
?>
--EXPECT--
1