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

Re: [FWP] Moment of Zen



>>>>> "RD" == Rick Delaney <rick.delaney@home.com> writes:

  RD> lr@hpl.hp.com wrote:
  >> 
  >> >     foreach $site (sort keys %sites) {
  >> >     }

  RD> Why should foreach be any slower than map (which seems like a pretty
  RD> explicit loop to me)?  Even though the burden of proof lies with you, I
  RD> think you've done more than your fair share of benchmarks so I offer
  RD> this one.

  RD>         $shares{$_} = mindshare($sites{$_}) for keys %sites;

well it helps to compare apples to macintoshes! a proper foreach
statement is a very different animal than a foreach statement modifier.

so your benchmarks are moot. map and foreach modifiers are know be be of
similar speed and both are generally faster than foreach statements. if
you can't grok why, someone else can elucidate. but as always YMMV.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com

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