mirror of
https://github.com/php-win-ext/phpy.git
synced 2026-03-24 17:02:15 +01:00
21 lines
401 B
PHP
21 lines
401 B
PHP
<?php
|
|
|
|
ini_set('memory_limit', '2G');
|
|
$dict = [];
|
|
const COUNT = 10000000;
|
|
|
|
$n = COUNT;
|
|
$s = microtime(true);
|
|
while ($n--) {
|
|
$dict['key-' . $n] = $n * 3;
|
|
}
|
|
echo 'array set: ' . round(microtime(true) - $s, 6) . ' seconds' . PHP_EOL;
|
|
|
|
$c = 0;
|
|
$n = COUNT;
|
|
$s = microtime(true);
|
|
while ($n--) {
|
|
$c += $dict['key-' . $n];
|
|
}
|
|
echo 'array get: ' . round(microtime(true) - $s, 6) . ' seconds' . PHP_EOL;
|