in reply to Re: use constant and Compiler Optimizations
in thread use constant and Compiler Optimizations
Stuff that gets optimized away does not necessarily take no time at all.
If you look at the tree the compiler generates, you'll see the call to bar isn't even present in it. The only thing left is the nextstate which is an incredibly fast operation.
>perl -MO=Concise,-exec -e"foo(); bar() if 0; baz();" 1 <0> enter 2 <;> nextstate(main 1 -e:1) v 3 <0> pushmark s 4 <#> gv[*foo] s/EARLYCV 5 <1> entersub[t2] vKS/TARG,1 6 <;> nextstate(main 1 -e:1) v <--- 7 <;> nextstate(main 1 -e:1) v 8 <0> pushmark s 9 <#> gv[*baz] s/EARLYCV a <1> entersub[t4] vKS/TARG,1 b <@> leave[1 ref] vKP/REFC -e syntax OK
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: use constant and Compiler Optimizations
by Joost (Canon) on Jul 18, 2008 at 20:43 UTC | |
by BrowserUk (Patriarch) on Jul 18, 2008 at 22:26 UTC |