On 6/10/20 7:48 AM, Terence O'Gorman wrote: > Bash Version: 5.0 > Patch Level: 11 > Release Status: release > > > Description: > > The 'while read' loop exhibits very different performance depending on > whether input is via redirection or pipeline (and increasingly diverging > performance with any increased data). Here are some results from my > machine (also observed in versions 3.0 and 4.0):
Two forks and one exec are expensive, as are the single-byte reads through the pipe. The single-byte reads are required because the shell is not allowed to read ahead in this case, since the remaining input may be intended for another process. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/