cat: Improve performance of formatting.#7519
Conversation
|
Benchmarking with this change... So still not as fast as GNU, but a big improvement. I'll try some other things too, but I'd like to get this change mainlined as-is, and anything else I can come up with I'll do in a separate PR. |
src/uu/cat/src/cat.rs
Outdated
| let stdout = io::stdout(); | ||
| let mut writer = stdout.lock(); | ||
| let stdout = stdout.lock(); | ||
| let mut writer = BufWriter::with_capacity(1024 * 32, stdout); |
There was a problem hiding this comment.
please document these numbers
|
kudos :) |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Hmm - cat-buf test is failing, I'll take a look... |
294fd55 to
3d1fd05
Compare
|
cat-buf fixed. I had to add some extra buffer-flushing. I re-ran my benchmark after this change and it's still looking good (numbers haven't changes significantly). |
|
GNU testsuite comparison: |
|
@karlmcdowall you closed it, was it on purpose ? :) |
|
Yeah! I wanted to check something related to the is_interactive flag in the code... I've managed to convince myself there isn't an issue there though, just some other potential optimizations to keep in mind for the future (which I'll write up at some point). |
|
GNU testsuite comparison: |
Issue uutils#7518 Add a BufWriter over stdout when cat outputs any kind of formattted data. This improves performance considerably.
|
GNU testsuite comparison: |
Issue #7518
Add a BufWriter over stdout when cat outputs any kind of formattted data. This improves performance considerably.