Closed Kogia-sima closed 3 years ago
itoap crate has very fast implementation for writing u128 in decimal format. It is derived from 6502's method, but is optimized for 64-bit system.
I ported that implementation to itoa repository and now performance has dramatically improved.
test bench_itoa_fmt::bench_u128_0 ... bench: 31 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_max ... bench: 433 ns/iter (+/- 2) test bench_itoa_write::bench_u128_0 ... bench: 31 ns/iter (+/- 0) test bench_itoa_write::bench_u128_max ... bench: 434 ns/iter (+/- 2)
test bench_itoa_fmt::bench_u128_0 ... bench: 30 ns/iter (+/- 0) test bench_itoa_fmt::bench_u128_max ... bench: 120 ns/iter (+/- 0) test bench_itoa_write::bench_u128_0 ... bench: 30 ns/iter (+/- 0) test bench_itoa_write::bench_u128_max ... bench: 121 ns/iter (+/- 0)
Note that this algorithm passes random tests, random digits tests, and boundary tests. (https://github.com/Kogia-sima/itoap/blob/ae36b332dac2495b4c2ff32977ea8f5080a083b6/src/lib.rs#L297-L421)
Closing in favour of #27
itoap crate has very fast implementation for writing u128 in decimal format. It is derived from 6502's method, but is optimized for 64-bit system.
I ported that implementation to itoa repository and now performance has dramatically improved.
Before
After
Note that this algorithm passes random tests, random digits tests, and boundary tests. (https://github.com/Kogia-sima/itoap/blob/ae36b332dac2495b4c2ff32977ea8f5080a083b6/src/lib.rs#L297-L421)