bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of tee(2) to speedup reading from pipes


From: Chet Ramey
Subject: Re: Use of tee(2) to speedup reading from pipes
Date: Mon, 24 Aug 2026 10:00:05 -0400
User-agent: Mozilla Thunderbird

On 8/23/26 6:45 PM, Sam James wrote:
Hi,

bash currently probes a pipe w/ lseek, sees it isn't seekable, and then
falls back to reading 1 byte at a time.

OK. Are we talking about the parser reading input, the read builtin, or
mapfile?

I'm not that familiar with tee(2), since it's Linux-specific. I guess
the idea would be to tee the input pipe into another random pipe, read
all the data from that second pipe, scan forward for the delimiter
(which differs depending on context), then read that many bytes from
the input pipe (up to the number of bytes returned by tee)?
Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]