<?php
$items = [
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
['a' => 'a', 'b' => 'b', 'c'=> 'c', 'd'=>'d', 'e'=>'e', 'f'=>'f'],
];
$iterations = 1000;
$start = microtime(true);
for ($i=0 ; $i<$iterations ; $i++) {
$reduced = array_reduce($items, fn($carry, $scope_items) => [...$carry, ...array_values($scope_items)], []);
}
$split = microtime(true);
for ($i=0 ; $i<$iterations ; $i++) {
$item_sets = [];
foreach ($items as $scope_items) {
$item_sets[] = array_values($scope_items);
}
$looped = array_merge(...$item_sets);
}
$end = microtime(TRUE);
echo "Reduce: " . ($split-$start)/$iterations . " sec\n";
echo "Merge: " . ($end-$split)/$iterations . " sec\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 24
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 33
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 24
Branch analysis from position: 42
Branch analysis from position: 24
Branch analysis from position: 33
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
Branch analysis from position: 8
filename: /in/JTPZh
function name: (null)
number of ops: 57
compiled vars: !0 = $items, !1 = $iterations, !2 = $start, !3 = $i, !4 = $reduced, !5 = $split, !6 = $item_sets, !7 = $scope_items, !8 = $looped, !9 = $end
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > ASSIGN !0, <array>
104 1 ASSIGN !1, 1000
106 2 INIT_FCALL 'microtime'
3 SEND_VAL <true>
4 DO_ICALL $12
5 ASSIGN !2, $12
108 6 ASSIGN !3, 0
7 > JMP ->16
109 8 > INIT_FCALL 'array_reduce'
9 SEND_VAR !0
10 DECLARE_LAMBDA_FUNCTION ~15 [0]
11 SEND_VAL ~15
12 SEND_VAL <array>
13 DO_ICALL $16
14 ASSIGN !4, $16
108 15 PRE_INC !3
16 > IS_SMALLER !3, !1
17 > JMPNZ ~19, ->8
112 18 > INIT_FCALL 'microtime'
19 SEND_VAL <true>
20 DO_ICALL $20
21 ASSIGN !5, $20
114 22 ASSIGN !3, 0
23 > JMP ->40
115 24 > ASSIGN !6, <array>
116 25 > FE_RESET_R $24 !0, ->33
26 > > FE_FETCH_R $24, !7, ->33
117 27 > INIT_FCALL 'array_values'
28 SEND_VAR !7
29 DO_ICALL $26
30 ASSIGN_DIM !6
31 OP_DATA $26
116 32 > JMP ->26
33 > FE_FREE $24
119 34 INIT_FCALL 'array_merge'
35 SEND_UNPACK !6
36 CHECK_UNDEF_ARGS
37 DO_ICALL $27
38 ASSIGN !8, $27
114 39 PRE_INC !3
40 > IS_SMALLER !3, !1
41 > JMPNZ ~30, ->24
122 42 > INIT_FCALL 'microtime'
43 SEND_VAL <true>
44 DO_ICALL $31
45 ASSIGN !9, $31
124 46 SUB ~33 !5, !2
47 DIV ~34 ~33, !1
48 CONCAT ~35 'Reduce%3A+', ~34
49 CONCAT ~36 ~35, '+sec%0A'
50 ECHO ~36
125 51 SUB ~37 !9, !5
52 DIV ~38 ~37, !1
53 CONCAT ~39 'Merge%3A+', ~38
54 CONCAT ~40 ~39, '+sec%0A'
55 ECHO ~40
56 > RETURN 1
Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/JTPZh
function name: {closure}
number of ops: 10
compiled vars: !0 = $carry, !1 = $scope_items
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
109 0 E > RECV !0
1 RECV !1
2 INIT_ARRAY ~2
3 ADD_ARRAY_UNPACK ~2 !0
4 INIT_FCALL 'array_values'
5 SEND_VAR !1
6 DO_ICALL $3
7 ADD_ARRAY_UNPACK ~2 $3
8 > RETURN ~2
9* > RETURN null
End of Dynamic Function 0
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
147.89 ms | 1445 KiB | 17 Q