about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-06 17:06:36 +0000
committerbors <bors@rust-lang.org>2014-07-06 17:06:36 +0000
commitf601c3e7c3e35c49752006b83d2580ca6349b852 (patch)
tree6612726c32d00211513e992053b8c38b3100b02f /src/rustllvm/ExecutionEngineWrapper.cpp
parent00a32f2f183078763aec4a96c6e81887530cc816 (diff)
parented3eee2e2a706d568f090f5d9862f0888dbdf670 (diff)
downloadrust-f601c3e7c3e35c49752006b83d2580ca6349b852.tar.gz
rust-f601c3e7c3e35c49752006b83d2580ca6349b852.zip
auto merge of #15465 : SimonSapin/rust/patch-4, r=alexcrichton
`Vec::push_all` with a length 1 slice seems to have significant overhead compared to `Vec::push`.

```
test new_push_byte ... bench:      6985 ns/iter (+/- 487) = 17 MB/s
test old_push_byte ... bench:     19335 ns/iter (+/- 1368) = 6 MB/s
```

```rust
extern crate test;
use test::Bencher;

static TEXT: &'static str = "\
    Unicode est un standard informatique qui permet des échanges \
    de textes dans différentes langues, à un niveau mondial.";

#[bench]
fn old_push_byte(bencher: &mut Bencher) {
    bencher.bytes = TEXT.len() as u64;
    bencher.iter(|| {
        let mut new = String::new();
        for b in TEXT.bytes() {
            unsafe { new.as_mut_vec().push_all([b]) }
        }
    })
}

#[bench]
fn new_push_byte(bencher: &mut Bencher) {
    bencher.bytes = TEXT.len() as u64;
    bencher.iter(|| {
        let mut new = String::new();
        for b in TEXT.bytes() {
            unsafe { new.as_mut_vec().push(b) }
        }
    })
}
```
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions