[Toybox] [PATCH] tr: fix pathological flushing.
enh
enh at google.com
Fri Dec 4 11:58:20 PST 2020
The AOSP build doesn't use tr (or anything that's still in pending), but
the kernel folks have been more aggressive. They found that tr's
pathological flushing was adding minutes to their build times.
Just removing the fflush() made tr significantly faster for my trivial
test, but still slow, with all the time going into stdio. Rewriting the
loop to modify toybuf in place and then do one write per read made most
of the difference, but special-casing the "neither -d nor -s" case made
a measurable difference too on a Xeon.
Bug: http://b/174773617
---
tests/tr.test | 11 +++++++++++
toys/pending/tr.c | 27 +++++++++++----------------
2 files changed, 22 insertions(+), 16 deletions(-)
create mode 100755 tests/tr.test
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20201204/d38cab57/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tr-fix-pathological-flushing.patch
Type: text/x-patch
Size: 2682 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20201204/d38cab57/attachment-0001.bin>
More information about the Toybox
mailing list