KN
Size: a a a
KN
SP
SP
KN
KN
KN
SP
SP
KN
KN
SP
KN
SP
KN
SP
F
<?phpможет я что-то не так понял?
declare(strict_types=1);
class Test {
}
function countTests(Test &...$tests) {
return count($tests);
}
$tests = [];
for ($i = 0; $i < 100; $i++) {
$tests[] = new Test();
}
$begin = microtime(true);
for ($i = 0; $i < 100000; $i++) {
countTests(...$tests);
}
echo 'Time: ' . round(microtime(true) - $begin, 3) . "\n";
3c3
< ; testArray.php:1-21
---
> ; testUnpack.php:1-21
27,28c27,28
< L23 (18): INIT_FCALL 1 112 string("counttests")
< L24 (18): SEND_VAR CV0($tests) 1
---
> L23 (18): INIT_FCALL 0 112 string("counttests")
> L24 (18): SEND_UNPACK CV0($tests)
51c51
< countTests: ; (lines=5, args=1, vars=1, tmps=1)
---
> countTests: ; (lines=5, args=0, vars=1, tmps=1)
53c53
< ; testArray.php:7-9
---
> ; testUnpack.php:7-9
55c55
< L1 (7): CV0($tests) = RECV 1
---
> L1 (7): CV0($tests) = RECV_VARIADIC 1
59c59
< Time: 0.069
---
> Time: 0.323
KN
KN
SP
KN