Skip to content

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

Merged
thestinger merged 2 commits into
rust-lang:masterfrom
thestinger:vec
Jul 10, 2013
Merged

vec::with_capacity: do one alloc for non-managed + ptr module improvements#7682
thestinger merged 2 commits into
rust-lang:masterfrom
thestinger:vec

Conversation

@thestinger

Copy link
Copy Markdown
Contributor

f74250e r=huonw

externmod extra;use std::vec;#[bench]fnbench_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
Copy Markdown
ContributorAuthor

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:masterJul 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`]
Fixrust-lang#7681
Sign up for freeto 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

@thestinger@bors