Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: printing every 2nd entry in a list backwards

by 1nickt (Prior)
on May 19, 2017 at 16:31 UTC ( #1190650=note: print w/replies, xml ) Need Help??


in reply to Re: printing every 2nd entry in a list backwards
in thread printing every 2nd entry in a list backwards

tobyink: is_fastest, cool! You always have the newest toys! Do you have an opinion about why grep with state is so much slower than grep with my?


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^3: printing every 2nd entry in a list backwards
by tobyink (Abbot) on May 19, 2017 at 16:56 UTC

    Well, it necessitates using a block, and the block form of grep is a little slower than the expression form.

    grep { BLOCK } @list; # slow grep EXPRESSION, @list; # fast

    But it's not just that. Even if you make them both use the block form of grep, state comes out behind my. I guess they've just put a lot of work into optimizing how fast normal lexical variables work, and less work into state variables.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1190650]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2017-07-20 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (304 votes). Check out past polls.