about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-09-18 12:32:35 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-09-26 22:20:40 -0700
commite02d1eb1717fee3c513baa0cb5fc39b8fa630335 (patch)
tree6f21aca82d147d6fba8dbb2000d5acabeefdf923 /src/rustllvm/RustWrapper.cpp
parent410a96cc79df4fbb3c2f30bdb2682b867df41a7e (diff)
downloadrust-e02d1eb1717fee3c513baa0cb5fc39b8fa630335.tar.gz
rust-e02d1eb1717fee3c513baa0cb5fc39b8fa630335.zip
std: Micro-optimize vec.with_c_str for short vectors
This now makes it unsafe to save the pointer returned by .with_c_str
as that pointer now may be pointing at a stack allocated array.

I arbitrarily chose 32 bytes as the length of the stack vector, and
so it might not be the most optimal size.

before:

test c_str::bench::bench_with_c_str_long ... bench: 539 ns/iter (+/- 91)
test c_str::bench::bench_with_c_str_medium ... bench: 97 ns/iter (+/- 2)
test c_str::bench::bench_with_c_str_short ... bench: 70 ns/iter (+/- 5)

after:

test c_str::bench::bench_with_c_str_long ... bench: 542 ns/iter (+/- 13)
test c_str::bench::bench_with_c_str_medium ... bench: 53 ns/iter (+/- 6)
test c_str::bench::bench_with_c_str_short ... bench: 19 ns/iter (+/- 0)
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions