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
In reply to Re: Reading from the end of a file. (broken)
by tye
in thread Reading from the end of a file.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |