Skip to content

Commit 1c12a4e

Browse files
committed
Add docs explaining that Read::bytes is slow.
1 parent 69ad06f commit 1c12a4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/io/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,10 @@ pub trait Read {
969969
///
970970
/// The default implementation calls `read` for each byte,
971971
/// which can be very inefficient for data that's not in memory,
972-
/// such as [`File`]. Consider using a [`BufReader`] in such cases.
972+
/// such as [`File`]. Consider using a [`BufReader`] in such cases. Even
973+
/// then, going through the [`BufReader`] for every byte will still be
974+
/// relatively slow. If speed is important, consider instead reading the
975+
/// input in larger chunks.
973976
///
974977
/// # Examples
975978
///

0 commit comments

Comments
 (0)