in reply to Search and Replace.

You can probably speed up file I/O a bit by reading x number of bytes plus the rest of the current line, then splitting on line endings and running through the lines in array form. This allows you to scale memory use to whatever your system can handle, unlike line-by-line reading or reading the entire file.

Replies are listed 'Best First'.
Re^2: Search and Replace.
by QM (Parson) on Jun 08, 2005 at 19:49 UTC
    I'm no expert, but file I/O should be buffered so this doesn't matter.

    I would think it's only an issue if the line lengths are on the order of the buffer size or larger. For this application, it sounds like the entire line is needed anyway, so there's still little difference.

    (May some gracious monk will correct me if I'm wrong.)

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of