Rate limit advancing the stream tail
Have a finite scrollback, big enough so that the scrollback buffer actually hits the disk. Maybe g-t's default 10000 or so.
After each and every newline, the streams' tails are advanced, which is a somewhat costly operation.
Here's a quick patch that rate limits this, advances the tail only after every 256th line that scrolls out.
0001-advance-tail-rate-limiting.patch
Needs proper testing. I hope that the data that "logically" disappears can't be brought back. We don't rely on the streams telling us the tail, instead, we use the Ring's m_start
, and whatever the row values index to in the two other streams. So I think we can't access that data anymore; it's still in the streams, but their wrapper Ring doesn't allow to access them.
That being said, this idea literally just occurred to me less than 10 minutes ago, I have just barely tested the patch.
cat
'ing a giant file gives a ~20% speed improvement.