Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: character-by-character in a huge file

by ambrus (Abbot)
on Apr 10, 2004 at 10:15 UTC ( [id://344109]=note: print w/replies, xml ) Need Help??


in reply to Re: character-by-character in a huge file
in thread character-by-character in a huge file

One character each time, why not? Perl already buffers the file so getc should be faster than a lot of magic with substr (or unpack).

  • Comment on Re: Re: character-by-character in a huge file

Replies are listed 'Best First'.
Re: Re: Re: character-by-character in a huge file
by bart (Canon) on Apr 10, 2004 at 12:26 UTC
    It depends on the frequency of the matches. I'm convinced that one call to index() on a string of 10k, with a negative result, or just a few matches, is a lot faster than 10000 calls to getc() and the same number of eq tests. It's a matter of doing the same task in C, or in Perl. C usually wins hands down.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found