Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

(MeowChow) Re3: (Efficiently) comparing arrays

by MeowChow (Vicar)
on Apr 04, 2002 at 10:19 UTC ( #156614=note: print w/replies, xml ) Need Help??


in reply to Re: Re: (Efficiently) comparing arrays
in thread comparing arrays

The only reason that this is slower than the faq answer, or the solution i just posted, is that you are using map in void context. This is an efficiency no-no.

update: demerphq is also correct, removing the lexical context indeed contributes some of the performance increase. Since this is a one-time performance penalty, its effect will be greater relative to smaller arrays.

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print
  • Comment on (MeowChow) Re3: (Efficiently) comparing arrays

Replies are listed 'Best First'.
Re: (MeowChow) Re3: (Efficiently) comparing arrays
by demerphq (Chancellor) on Apr 04, 2002 at 14:09 UTC
    And also because the map he used has a lexically scoped block but the for loop that you used does not. Handling the scope has an overhead associated with it im pretty sure.

    just my $0.02

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://156614]
help
Chatterbox?
Discipulus is Corion reading 'Gory details of parsing quoted constructs'?..
[perldigious]: That's awesome erix. One of my work friends, who coincidentally convinced me to learn Perl originally, has a Finnish pen-pal. I showed him this and he immediately wanted to send it along to her.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2016-12-06 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (112 votes). Check out past polls.