Closed Object905 closed 6 years ago
Allows to save some stack space. Useful with no_std. No public API changes.
no_std
Maximum lengths was generated with this.
Benchmarks are:
Before:
test bench_itoa_fmt::bench_i16_0 ... bench: 9 ns/iter (+/- 0) test bench_itoa_fmt::bench_i16_min ... bench: 12 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_0 ... bench: 12 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_max ... bench: 254 ns/iter (+/- 2) test bench_itoa_fmt::bench_u64_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_fmt::bench_u64_half ... bench: 24 ns/iter (+/- 1) test bench_itoa_fmt::bench_u64_max ... bench: 20 ns/iter (+/- 0) test bench_itoa_write::bench_i16_0 ... bench: 9 ns/iter (+/- 0) test bench_itoa_write::bench_i16_min ... bench: 12 ns/iter (+/- 0) test bench_itoa_write::bench_u128_0 ... bench: 12 ns/iter (+/- 0) test bench_itoa_write::bench_u128_max ... bench: 253 ns/iter (+/- 5) test bench_itoa_write::bench_u64_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_write::bench_u64_half ... bench: 24 ns/iter (+/- 0) test bench_itoa_write::bench_u64_max ... bench: 21 ns/iter (+/- 0)
After:
test bench_itoa_fmt::bench_i16_0 ... bench: 9 ns/iter (+/- 0) test bench_itoa_fmt::bench_i16_min ... bench: 12 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_0 ... bench: 12 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_max ... bench: 254 ns/iter (+/- 2) test bench_itoa_fmt::bench_u64_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_fmt::bench_u64_half ... bench: 14 ns/iter (+/- 0) test bench_itoa_fmt::bench_u64_max ... bench: 20 ns/iter (+/- 0) test bench_itoa_write::bench_i16_0 ... bench: 9 ns/iter (+/- 0) test bench_itoa_write::bench_i16_min ... bench: 12 ns/iter (+/- 1) test bench_itoa_write::bench_u128_0 ... bench: 11 ns/iter (+/- 0) test bench_itoa_write::bench_u128_max ... bench: 254 ns/iter (+/- 2) test bench_itoa_write::bench_u64_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_write::bench_u64_half ... bench: 13 ns/iter (+/- 0) test bench_itoa_write::bench_u64_max ... bench: 21 ns/iter (+/- 0)
After #[inline]:
#[inline]
test bench_itoa_fmt::bench_i16_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_fmt::bench_i16_min ... bench: 11 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_0 ... bench: 11 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_max ... bench: 249 ns/iter (+/- 3) test bench_itoa_fmt::bench_u64_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_fmt::bench_u64_half ... bench: 13 ns/iter (+/- 0) test bench_itoa_fmt::bench_u64_max ... bench: 19 ns/iter (+/- 1) test bench_itoa_write::bench_i16_0 ... bench: 9 ns/iter (+/- 0) test bench_itoa_write::bench_i16_min ... bench: 11 ns/iter (+/- 0) test bench_itoa_write::bench_u128_0 ... bench: 11 ns/iter (+/- 0) test bench_itoa_write::bench_u128_max ... bench: 250 ns/iter (+/- 9) test bench_itoa_write::bench_u64_0 ... bench: 8 ns/iter (+/- 0) test bench_itoa_write::bench_u64_half ... bench: 13 ns/iter (+/- 0) test bench_itoa_write::bench_u64_max ... bench: 19 ns/iter (+/- 0)
I released this improvement in 0.4.1.
Allows to save some stack space. Useful with
no_std
. No public API changes.Maximum lengths was generated with this.
Benchmarks are:
Before:
After:
After
#[inline]
: