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

Re: [FWP] Moment of Zen



lr@hpl.hp.com wrote:
> 
> >     foreach $site (sort keys %sites) {
> >       #...
> >       my $mindshare = mindshare(...);
> >       $shares{$site} = $mindshare;
> >     }
> 
> Why an explicit (slow) loop?
> 
>       my %shares;
>       @shares{keys %sites} = map mindshare($_) => values %sites;

I realize the argument has shifted to performance... but, larry,
what you wrote isn't the same as the original.
I think you should have written

      my %shares;
      @shares{keys %sites} = map mindshare($_) => keys %sites;

Note the source for the map is keys %sites, not values %sites.

And I think this shifts the entire direction of how this code
can be optimized.

-- 
John Porter


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