The stupid question is the question not asked | |
PerlMonks |
Re: Efficiency of $$var, ${$var}by MZSanford (Curate) |
on Aug 20, 2001 at 13:35 UTC ( [id://106161]=note: print w/replies, xml ) | Need Help?? |
They call me obsessed. They call me crazy. But fear not, the Over-Optimizer is here. I, like many programmers, will optimise the smallest code just to eek out the smallest gains. In doing this you learn the art of optimsation.Also, i am a programmer, not an english teacher, so please ignore any spelling errors. See below : Checking : $$var vs. ${$var} Test Code :
Tests : perl -MO=Deparse,-p test_ref.pl if inconclusive ... perl -Dt test_ref.pl Test 1 :
hmmmm, no real help there. Actually, based on the ";" added on the second print, ${$var} might be slower (which would make my guess wrong). Test 2 :
Eurica ! Now, for those who did not spot it, here is what i am seeing : The first line which has (test_ref.pl:7) is entering the print statement. Reading from there to the end, there are two duplicated sections, meaning the exact same path is used for both de-referencers. So, to show it more clearly (sorry about any code wrapping) :
So, $$var and ${$var} are the same after optimisation. always more than one way to skin an amoebae -- MZSanford
In Section
Seekers of Perl Wisdom
|
|