develooper Front page | perl.perl5.porters | Postings from October 2004

Re: optimization idea

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
October 26, 2004 03:32
Subject:
Re: optimization idea
Message ID:
20041026123056.CFD6.H.M.BRAND@hccnet.nl
On Tue 26 Oct 2004 12:24, Elizabeth Mattijsen <liz@dijkmat.nl> wrote:
> >>  > sub statename {
> >>  >     my $name = 'david';
> >>  >     ${\$name} = 'liz';
> >>  >     return "hello, my name is $name";
> >>  > }
> >
> >But surely in this case the ${\$name} should itself be optimised to $name
> >first?
> 
> Well, possibly.  I just wrote it that way to be as succinct as 
> possible.  I seriously doubt whether spending the extra cycles for 
> checking for this particular type of situation are worth the 
> optimization.

This one would be a compile time optimilization, and would happen only once.
The de-ref would be done run-time, and the time gained is completely depending
on how often it would happen

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.3, & 5.9.x, and 809 on  HP-UX 10.20 & 11.00, 11i,
   AIX 4.3, SuSE 9.0, and Win2k.           http://www.cmve.net/~merijn/
http://archives.develooper.com/daily-build@perl.org/   perl-qa@perl.org
send smoke reports to: smokers-reports@perl.org, QA: http://qa.perl.org



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About