Skip to content

Commit 367f46d

Browse files
committed
Make note of performance implications of Read
Fixes rust-lang#28073
1 parent 3e6d724 commit 367f46d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libstd/io/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize>
370370
/// throughout `std::io` take and provide types which implement the `Read`
371371
/// trait.
372372
///
373+
/// Please note that each call to `read` may involve a system call, and
374+
/// therefore, using something that implements [`BufRead`][bufread], such as
375+
/// [`BufReader`][bufreader], will be more efficient.
376+
///
377+
/// [bufread]: trait.BufRead.html
378+
/// [bufreader]: struct.BufReader.html
379+
///
373380
/// # Examples
374381
///
375382
/// [`File`][file]s implement `Read`:

0 commit comments

Comments
 (0)