[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Benchmarking $|++



On 8 Nov 99, at 16:16, Andy Lester wrote:

> > >[...] saying that someone else who had written
> > >         $|++;
> > >should have written it as
> > >         $| = 1;
> > >since it executes faster (and produced Benchmark data to prove it).
> 
> It's all part of this hacker mentality that faster == better.

Actually, the converse also carries an indictment: that for some hackers, 
a char shorter == better, which is hardly a better programming practice 
[at least 'faster' can be argued has some potential utility (although 
obviously not in this case)].

Look at it from a different perspective: when the docs say "When $| is 
non zero...", is it perfectly clear that '$|++' will always be making it 
non-zero?  What if some future programmer missed that line and up in the 
header of the program wrote "$| = -1" [picking '-1' as their preference 
for a random non-zero value].   Writing "$| = 1" is unequivocal, robust, 
and clear, which is one of my '== better' criteria...

 /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
mailto:bernie@fantasyfarm.com     Pearisburg, VA
    -->  Too many people, too few sheep  <--          


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe