Skip to content

Conversation

@thestinger
Copy link
Contributor

f74250e r=huonw

extern mod extra;

use std::vec;

#[bench]
fn bench_with_capacity(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let _v: ~[u8] = vec::with_capacity(1024);
    }
}

Before:

test bench_with_capacity ... bench: 293 ns/iter (+/- 0)

After:

test bench_with_capacity ... bench: 125 ns/iter (+/- 3)

@thestinger
Copy link
Contributor Author

Tests all passed, bors is just being weird.

thestinger added a commit that referenced this pull request Jul 10, 2013
vec::with_capacity: do one alloc for non-managed + ptr module improvements
@thestinger thestinger merged commit b5e9194 into rust-lang:master Jul 10, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 21, 2021
Implement uninit_vec lint

changelog: add the new lint [`uninit_vec`]

Fix rust-lang#7681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants