TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
470 B
23 lines
470 B
<?php
|
|
|
|
use native_types;
|
|
|
|
function main(int $argc, array $argv): void
|
|
{
|
|
$u = (int)$argv[2];
|
|
echo "u: $u\n";
|
|
$r = rand(0, 10000);
|
|
$a = std::array(native_types::type_int, 10000);
|
|
|
|
$begin = microtime(true);
|
|
for ($i = 0; $i < 10000; $i++) {
|
|
for ($j = 0; $j < 100000; $j++) {
|
|
$a[$i] += $j % $u;
|
|
}
|
|
$a[$i] += $r;
|
|
}
|
|
|
|
echo $a[$r] . "\n";
|
|
$end = microtime(true);
|
|
echo "sec: " . ($end - $begin) . "\n";
|
|
}
|
|
|