in reply to Reading from the end of a file.

Note that your fastest case is also the only one that doesn't handle long lines. I find it a pretty poor benchmark to reimplement a module's logic badly and then wonder if it runs faster. Fix the 'rawio' case to handle things as well as File::ReadBackwards (and the other cases) do(es) and it'll be closer in speed. I'm sure it will still be faster, since it doesn't use tied handles or actually deal with a general purpose problem.

But I'd still use File::ReadBackwards or "tail" since I don't find "get last line of a file" to be something I care to heavily optimize on the few occasions when I do it and the code to properly handle all of the boundary cases is not something I care to maintain on its own.

- tye        

  • Comment on Re: Reading from the end of a file. (broken)

Replies are listed 'Best First'.
Re: Re: Reading from the end of a file. (probably not)
by BrowserUk (Patriarch) on May 20, 2004 at 17:11 UTC

    S'funny, that's pretty much exactly what I said here. I only included rawio it for completeness.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail