Closed
Description
On my laptop, I get the following results when running benchmarks for non-seekable files...
hyperfine "cat shakespeare.txt | head -n -100000" "cat shakespeare.txt | ./target/release/head -n -100000"
Summary
cat shakespeare.txt | head -n -100000 ran
16.03 ± 1.60 times faster than cat shakespeare.txt | ./target/release/head -n -100000
hyperfine "cat shakespeare.txt | head -c -100000" "cat shakespeare.txt | ./target/release/head -c -100000"
Summary
cat shakespeare.txt | head -c -100000 ran
18.56 ± 1.61 times faster than cat shakespeare.txt | ./target/release/head -c -100000
So the current Rust implementation is a lot slower than GNU for non-seekable files.
I have some changes drafted to resolve this and they seem to be work well. I need to tidy up the code and then I'll post with updated benchmarking results.