about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-10-08 13:39:04 +0800
committerGitHub <noreply@github.com>2017-10-08 13:39:04 +0800
commit262612c306c6f9af096ccee417b1238ac78462a7 (patch)
tree08d05385b7ace01dc86568ac71b578d719927c78 /src/test/incremental/thinlto
parentdb202e34ae9490c4a9a94ce51482c03eb2bbb2d0 (diff)
parentd52acbe37f69a2ebc9d161c479ed628da1cbea4e (diff)
downloadrust-262612c306c6f9af096ccee417b1238ac78462a7.tar.gz
rust-262612c306c6f9af096ccee417b1238ac78462a7.zip
Rollup merge of #45083 - fhartwig:slice-read-to-end, r=bluss
Add read_to_end implementation to &[u8]'s Read impl

The default impl for read_to_end does a bunch of bookkeeping
that isn't necessary for slices and is about 4 times slower
on my machine.

The following benchmark takes about 30 ns before this change and about 7 ns after:

```
#[bench]
fn bench_read_std(b: &mut Bencher) {
    let data = vec![0u8; 100];
    let mut v = Vec::with_capacity(200);
    b.iter(|| {
        let mut s = data.as_slice();
        v.clear();
        s.read_to_end(&mut v).unwrap();
    });
}
```

This solves the easy part of  https://github.com/rust-lang/rust/issues/44819 (I think extending this to `Take<&[u8]> `would require specialization)
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions