@@ -25,6 +25,12 @@ use memchr;
25
25
/// results in a system call. A `BufReader` performs large, infrequent reads on
26
26
/// the underlying [`Read`] and maintains an in-memory buffer of the results.
27
27
///
28
+ /// `BufReader` can improve the speed of programs that make *small* and
29
+ /// *repeated* read calls to the same file or network socket. It does not
30
+ /// help when reading very large amounts at once, or reading just one or a few
31
+ /// times. It also provides no advantage when reading from a source that is
32
+ /// already in memory, like a `Vec<u8>`.
33
+ ///
28
34
/// [`Read`]: ../../std/io/trait.Read.html
29
35
/// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read
30
36
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html
@@ -359,6 +365,12 @@ impl<R: Seek> Seek for BufReader<R> {
359
365
/// `BufWriter` keeps an in-memory buffer of data and writes it to an underlying
360
366
/// writer in large, infrequent batches.
361
367
///
368
+ /// `BufWriter` can improve the speed of programs that make *small* and
369
+ /// *repeated* write calls to the same file or network socket. It does not
370
+ /// help when writing very large amounts at once, or writing just one or a few
371
+ /// times. It also provides no advantage when writing to a destination that is
372
+ /// in memory, like a `Vec<u8>`.
373
+ ///
362
374
/// When the `BufWriter` is dropped, the contents of its buffer will be written
363
375
/// out. However, any errors that happen in the process of flushing the buffer
364
376
/// when the writer is dropped will be ignored. Code that wishes to handle such
0 commit comments