Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Efficient walk/iterate along a string

by SimonClinch (Chaplain)
on Nov 23, 2010 at 10:46 UTC ( #873159=note: print w/ replies, xml ) Need Help??


in reply to Efficient walk/iterate along a string

It's probably faster to use the C-style for loop,

for ( my $i=0; $i <= $max; $i++ ) { }
On the other hand, you might even want to do this whole loop from within C itself. See ch 21.3. Extending Perl (Using C from Perl) of Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant (ISBN 059600027).

erm correction, I mean do the substring extraction from C not the processing you do with it. Although the perl loop will indeed consume less resources if C-style instead of forcing a huge list to be constructed.

One world, one people


Comment on Re: Efficient walk/iterate along a string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2015-07-05 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls