Per my reading of the opcodes, you'll spend a lot of time looking for something that's not there. There are two extra ops in the interpolation case, but they're optimized away.
$ perl -MO=Concise my $s = 'foo'; my $string = "${s}bar"; c <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -:1) v ->3 5 <2> sassign vKS/2 ->6 3 <$> const(PV "foo") s ->4 4 <0> padsv[$s:1,3] sRM*/LVINTRO ->5 6 <;> nextstate(main 2 -:2) v ->7 b <2> sassign vKS/2 ->c - <1> ex-stringify sK/1 ->a - <0> ex-pushmark s ->7 9 <2> concat[t3] sK/2 ->a 7 <0> padsv[$s:1,3] s ->8 8 <$> const(PV "bar") s ->9 a <0> padsv[$string:2,3] sRM*/LVINTRO ->b - syntax OK $ perl -MO=Concise my $s = 'foo'; my $string = $s . 'bar'; c <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -:1) v ->3 5 <2> sassign vKS/2 ->6 3 <$> const(PV "foo") s ->4 4 <0> padsv[$s:1,3] sRM*/LVINTRO ->5 6 <;> nextstate(main 2 -:2) v ->7 b <2> sassign vKS/2 ->c 9 <2> concat[t3] sK/2 ->a 7 <0> padsv[$s:1,3] s ->8 8 <$> const(PV "bar") s ->9 a <0> padsv[$string:2,3] sRM*/LVINTRO ->b - syntax OK
In reply to Re: String Concatenation Performance
by chromatic
in thread String Concatenation Performance
by pbeckingham
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |