Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vec::with_capacity: do one alloc for non-managed + ptr module improvements #7682

Merged
merged 2 commits into from Jul 10, 2013
Merged

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.

None yet

2 participants