Skip to content

Instantly share code, notes, and snippets.

@tsee
Created February 21, 2014 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsee/9135998 to your computer and use it in GitHub Desktop.
Save tsee/9135998 to your computer and use it in GitHub Desktop.
Which of these OP trees would you expect to execute more quickly?
Which of these OP trees would you expect to execute more quickly?
(Provided that other than what you see here, they're doing the same thing!)
$ perl_a -MO=Concise -e '@x = @x{1, 2};'
g <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
f <2> aassign[t3] vKS/COMMON ->g
- <1> ex-list lK ->c
3 <0> pushmark s ->4
b <@> hslice lK ->c
4 <0> pushmark s ->5
8 <@> list lK ->9
5 <0> pushmark s ->6
6 <$> const(PV "1") s ->7
7 <$> const(PV "2") s ->8
a <1> rv2hv[t2] sKR/1 ->b
9 <$> gv(*x) s ->a
- <1> ex-list lK ->f
c <0> pushmark s ->d
e <1> rv2av[t1] lKRM*/1 ->f
d <$> gv(*x) s ->e
-e syntax OK
$ perl_b -MO=Concise -e '@x = @x{1, 2};'
e <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
d <2> aassign[t3] vKS/COMMON ->e
- <1> ex-list lK ->a
3 <0> pushmark s ->4
9 <@> hslice lK ->a
4 <0> pushmark s ->-
- <1> ex-list lK ->7
- <0> ex-pushmark s ->5
5 <$> const(IV 1) s ->6
6 <$> const(IV 2) s ->7
8 <1> rv2hv[t2] sKR/1 ->9
7 <$> gv(*x) s ->8
- <1> ex-list lK ->d
a <0> pushmark s ->b
c <1> rv2av[t1] lKRM*/1 ->d
b <$> gv(*x) s ->c
-e syntax OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment