Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Answer: How can I skip an element in an array whilst reading...

by belg4mit (Prior)
on Apr 07, 2002 at 18:19 UTC ( [id://157292]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    q(
    Benchmark: timing 100000 iterations of C-style, push...
       C-style:  2 wallclock secs ( 3.20 usr +  0.00 sys =  3.20 CPU) @ 31
    +279.32/s (n=100000)
          push:  3 wallclock secs ( 2.63 usr +  0.09 sys =  2.72 CPU) @ 36
    +724.20/s (n=100000)
    
  2. or download this
    #These "cripple" C-style and push to make it a fair fight, by reinitia
    +lizing the array each time
    Benchmark: timing 100000 iterations of C-style, destroy, push...
    ...
          push:  2 wallclock secs ( 2.38 usr +  0.00 sys =  2.38 CPU) @ 41
    +9463.09/s(n=1000000)
    
    );
    
  3. or download this
    @in = (1,2,3,4,5,6,7,8,9,0);
    use Benchmark;
    ...
                 push @out1, shift(@in);
                 push @out2, shift(@in); }'
              });
    
  4. or download this
    q(
    #These "cripple" C-style and push to make it a fair fight, by reinitia
    +lizing the array each time
    ...
                 print OUT @out1,"\n";
                 print OUT @out2,"\n";'
              });
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://157292]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-25 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found