<?php
function check_unique() {
$seen = new ArrayObject();
return function ($value) use ($seen) {
if (in_array($value, (array)$seen)) {
return false;
}
$seen[] = $value;
return true;
};
}
const ITEMS = 10000;
$array = array_merge(range(1, ITEMS, 3), range(1, ITEMS, 2));
echo "started with ", count($array), " items\n";
$check_unique = check_unique();
$unique = [];
echo "memory usage ", memory_get_peak_usage(), "\n";
$time = -microtime(true);
foreach ($array as $value) {
if ($check_unique($value)) {
$unique[] = $value;
}
}
$time += microtime(true);
echo "memory usage ", memory_get_peak_usage(), "\n";
echo "took $time sec\n";
echo "finished with ", count($unique), " items\n";
- Output for 7.4.1
- started with 8334 items
memory usage 1321536
memory usage 1986056
took 0.41924405097961 sec
finished with 6667 items
- Output for 7.4.0
- started with 8334 items
memory usage 1321536
memory usage 1986056
took 0.3996250629425 sec
finished with 6667 items
- Output for 7.3.13
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.32490110397339 sec
finished with 6667 items
- Output for 7.3.12
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.24370408058167 sec
finished with 6667 items
- Output for 7.3.11
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.32294392585754 sec
finished with 6667 items
- Output for 7.3.10
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.21829891204834 sec
finished with 6667 items
- Output for 7.3.9
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.30254817008972 sec
finished with 6667 items
- Output for 7.3.8
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.21594715118408 sec
finished with 6667 items
- Output for 7.3.7
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.21021699905396 sec
finished with 6667 items
- Output for 7.3.6
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.22731399536133 sec
finished with 6667 items
- Output for 7.3.5
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.25302386283875 sec
finished with 6667 items
- Output for 7.3.4
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.2326021194458 sec
finished with 6667 items
- Output for 7.3.3
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.24348592758179 sec
finished with 6667 items
- Output for 7.3.2
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.22730898857117 sec
finished with 6667 items
- Output for 7.3.1
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.28709316253662 sec
finished with 6667 items
- Output for 7.3.0
- started with 8334 items
memory usage 1321504
memory usage 1719728
took 0.28074979782104 sec
finished with 6667 items
- Output for 7.2.26
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.25951600074768 sec
finished with 6667 items
- Output for 7.2.25
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.33442902565002 sec
finished with 6667 items
- Output for 7.2.24
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.25552105903625 sec
finished with 6667 items
- Output for 7.2.23
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.23543620109558 sec
finished with 6667 items
- Output for 7.2.22
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.24450302124023 sec
finished with 6667 items
- Output for 7.2.21
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.29042720794678 sec
finished with 6667 items
- Output for 7.2.20
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.26569104194641 sec
finished with 6667 items
- Output for 7.2.19
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.27572798728943 sec
finished with 6667 items
- Output for 7.2.18
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.23668789863586 sec
finished with 6667 items
- Output for 7.2.17
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.22115302085876 sec
finished with 6667 items
- Output for 7.2.16
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.23352599143982 sec
finished with 6667 items
- Output for 7.2.15
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.26205897331238 sec
finished with 6667 items
- Output for 7.2.14
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.29398393630981 sec
finished with 6667 items
- Output for 7.2.13
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.27512693405151 sec
finished with 6667 items
- Output for 7.2.12
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.24106407165527 sec
finished with 6667 items
- Output for 7.2.11
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.21637010574341 sec
finished with 6667 items
- Output for 7.2.10
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.32777690887451 sec
finished with 6667 items
- Output for 7.2.9
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.26632595062256 sec
finished with 6667 items
- Output for 7.2.8
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.32581901550293 sec
finished with 6667 items
- Output for 7.2.7
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.31084895133972 sec
finished with 6667 items
- Output for 7.2.6
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.29891896247864 sec
finished with 6667 items
- Output for 7.2.5
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.21831703186035 sec
finished with 6667 items
- Output for 7.2.4
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.33056497573853 sec
finished with 6667 items
- Output for 7.2.3
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.21661591529846 sec
finished with 6667 items
- Output for 7.2.2
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.23521494865417 sec
finished with 6667 items
- Output for 7.2.1
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.30911493301392 sec
finished with 6667 items
- Output for 7.2.0
- started with 8334 items
memory usage 1317832
memory usage 1716056
took 0.33528208732605 sec
finished with 6667 items
- Output for 7.1.33
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.17647814750671 sec
finished with 6667 items
- Output for 7.1.32
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.18200206756592 sec
finished with 6667 items
- Output for 7.1.31
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.19298005104065 sec
finished with 6667 items
- Output for 7.1.30
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.20662093162537 sec
finished with 6667 items
- Output for 7.1.29
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.21913695335388 sec
finished with 6667 items
- Output for 7.1.28
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.17968606948853 sec
finished with 6667 items
- Output for 7.1.27
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.1812539100647 sec
finished with 6667 items
- Output for 7.1.26
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.18355083465576 sec
finished with 6667 items
- Output for 7.1.25
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.18591284751892 sec
finished with 6667 items
- Output for 7.1.24
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.18144392967224 sec
finished with 6667 items
- Output for 7.1.23
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.20181202888489 sec
finished with 6667 items
- Output for 7.1.22
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.1803150177002 sec
finished with 6667 items
- Output for 7.1.21
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.20418405532837 sec
finished with 6667 items
- Output for 7.1.20
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.19630599021912 sec
finished with 6667 items
- Output for 7.1.19
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.18507599830627 sec
finished with 6667 items
- Output for 7.1.18
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26533102989197 sec
finished with 6667 items
- Output for 7.1.17
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26623797416687 sec
finished with 6667 items
- Output for 7.1.16
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.2636890411377 sec
finished with 6667 items
- Output for 7.1.15
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.19931697845459 sec
finished with 6667 items
- Output for 7.1.14
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.27348303794861 sec
finished with 6667 items
- Output for 7.1.13
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.2097909450531 sec
finished with 6667 items
- Output for 7.1.12
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26514005661011 sec
finished with 6667 items
- Output for 7.1.11
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.24310111999512 sec
finished with 6667 items
- Output for 7.1.10
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.20518803596497 sec
finished with 6667 items
- Output for 7.1.9
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26726198196411 sec
finished with 6667 items
- Output for 7.1.8
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.19225597381592 sec
finished with 6667 items
- Output for 7.1.7
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26615595817566 sec
finished with 6667 items
- Output for 7.1.6
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.19690489768982 sec
finished with 6667 items
- Output for 7.1.5
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.17916893959045 sec
finished with 6667 items
- Output for 7.1.4
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.2627489566803 sec
finished with 6667 items
- Output for 7.1.3
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.18464398384094 sec
finished with 6667 items
- Output for 7.1.2
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.17487382888794 sec
finished with 6667 items
- Output for 7.1.1
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26338195800781 sec
finished with 6667 items
- Output for 7.1.0
- started with 8334 items
memory usage 1281496
memory usage 1679720
took 0.26923394203186 sec
finished with 6667 items
- Output for 7.0.33
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.17959809303284 sec
finished with 6667 items
- Output for 7.0.32
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.17386603355408 sec
finished with 6667 items
- Output for 7.0.31
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.21076512336731 sec
finished with 6667 items
- Output for 7.0.30
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.20132803916931 sec
finished with 6667 items
- Output for 7.0.29
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.20186495780945 sec
finished with 6667 items
- Output for 7.0.28
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26169085502625 sec
finished with 6667 items
- Output for 7.0.27
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.21972918510437 sec
finished with 6667 items
- Output for 7.0.26
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.23924398422241 sec
finished with 6667 items
- Output for 7.0.25
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26318192481995 sec
finished with 6667 items
- Output for 7.0.24
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.23594808578491 sec
finished with 6667 items
- Output for 7.0.23
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.19046998023987 sec
finished with 6667 items
- Output for 7.0.22
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.18918895721436 sec
finished with 6667 items
- Output for 7.0.21
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.2665650844574 sec
finished with 6667 items
- Output for 7.0.20
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26305985450745 sec
finished with 6667 items
- Output for 7.0.19
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.24987316131592 sec
finished with 6667 items
- Output for 7.0.18
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.17810487747192 sec
finished with 6667 items
- Output for 7.0.17
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.17702484130859 sec
finished with 6667 items
- Output for 7.0.16
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.18482494354248 sec
finished with 6667 items
- Output for 7.0.15
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26180291175842 sec
finished with 6667 items
- Output for 7.0.14
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26420092582703 sec
finished with 6667 items
- Output for 7.0.13
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26867890357971 sec
finished with 6667 items
- Output for 7.0.12
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.25177001953125 sec
finished with 6667 items
- Output for 7.0.11
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.23861789703369 sec
finished with 6667 items
- Output for 7.0.10
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26780295372009 sec
finished with 6667 items
- Output for 7.0.9
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.19487500190735 sec
finished with 6667 items
- Output for 7.0.8
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.18326997756958 sec
finished with 6667 items
- Output for 7.0.7
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.28113508224487 sec
finished with 6667 items
- Output for 7.0.6
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.27337718009949 sec
finished with 6667 items
- Output for 7.0.5
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.26282811164856 sec
finished with 6667 items
- Output for 7.0.4
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.27235889434814 sec
finished with 6667 items
- Output for 7.0.3
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.27221584320068 sec
finished with 6667 items
- Output for 7.0.2
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.186518907547 sec
finished with 6667 items
- Output for 7.0.1
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.18488216400146 sec
finished with 6667 items
- Output for 7.0.0
- started with 8334 items
memory usage 1281456
memory usage 1680056
took 0.271075963974 sec
finished with 6667 items
- Output for 5.6.40
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.3180241584778 sec
finished with 6667 items
- Output for 5.6.0 - 5.6.2, 5.6.4 - 5.6.30, 5.6.39
- started with 8334 items
memory usage 2375752
Process exited with code 137. - Output for 5.6.38
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.4581868648529 sec
finished with 6667 items
- Output for 5.6.37
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.360100030899 sec
finished with 6667 items
- Output for 5.6.36
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.349338054657 sec
finished with 6667 items
- Output for 5.6.35
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.4201219081879 sec
finished with 6667 items
- Output for 5.6.34
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.4202260971069 sec
finished with 6667 items
- Output for 5.6.33
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.4667510986328 sec
finished with 6667 items
- Output for 5.6.32
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.4262490272522 sec
finished with 6667 items
- Output for 5.6.31
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.3749208450317 sec
finished with 6667 items
- Output for 5.6.3
- started with 8334 items
memory usage 2375752
memory usage 3451280
took 2.4740037918091 sec
finished with 6667 items
- Output for 5.5.0 - 5.5.38
- started with 8334 items
memory usage 2375488
Process exited with code 137. - Output for 5.4.10 - 5.4.25, 5.4.27 - 5.4.45
- started with 8334 items
memory usage 2375864
Process exited with code 137. - Output for 5.4.26
- started with 8334 items
memory usage 2375864
memory usage 3451392
took 2.4640538692474 sec
finished with 6667 items
- Output for 5.4.1 - 5.4.9
- started with 8334 items
memory usage 2375944
Process exited with code 137. - Output for 5.4.0
- started with 8334 items
memory usage 2375944
memory usage 3451648
took 2.3816668987274 sec
finished with 6667 items
- Output for 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected '[' in /in/4pvOJ on line 19
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
- Parse error: syntax error, unexpected T_FUNCTION in /in/4pvOJ on line 5
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_FUNCTION in /in/4pvOJ on line 5
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/4pvOJ on line 5
Process exited with code 255.
preferences:
218.89 ms | 401 KiB | 325 Q