-
Notifications
You must be signed in to change notification settings - Fork 121
Closed
Description
The performance of Read::bytes()
iterator is atrocious, even over a BufReader
.
Here's a sample program calculating a sum of all bytes in the file with various approaches:
In this test Read::bytes()
10x slower than reading the whole file into memory up front and 20x slower than manually reading into a smallish buffer over and over. The performance gap is so large that even reading line-by-line with UTF-8 validation is still multiple times faster!
Benchmarked using hyperfine
on this public domain book in plain text format repeated 50 times.
Metadata
Metadata
Assignees
Labels
No labels