tail

Chris Angelico rosuav at gmail.com
Sat Apr 23 20:39:48 EDT 2022


On Sun, 24 Apr 2022 at 10:04, Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 24Apr2022 08:21, Chris Angelico <rosuav at gmail.com> wrote:
> >On Sun, 24 Apr 2022 at 08:18, Cameron Simpson <cs at cskk.id.au> wrote:
> >> An approach I think you both may have missed: mmap the file and use
> >> mmap.rfind(b'\n') to locate line delimiters.
> >> https://docs.python.org/3/library/mmap.html#mmap.mmap.rfind
> >
> >Yeah, I made a vague allusion to use of mmap, but didn't elaborate
> >because I actually have zero idea of how efficient this would be.
> >Would it be functionally equivalent to the chunking, but with the
> >chunk size defined by the system as whatever's most optimal? It would
> >need to be tested.
>
> True. I'd expect better than single byte seek/read though.
>

Yeah, I think pretty much *anything* would be better than single byte seeks.

ChrisA


More information about the Python-list mailing list