3 ms·
Apparently Ryu is slower on shorter numbers than the Rust standard library's implementation which uses Grisu/Dragon. It might be only due to the implementation
by est31 6y ago
Apparently Ryu is slower on shorter numbers than the Rust standard library's implementation which uses Grisu/Dragon. It might be only due to the implementation though. https://www.reddit.com/r/rust/comments/93d045/fast_floattostring_conversion_ryu_for_rust/e3d24f4/ https://www.reddit.com/r/rust/comments/93d045/fast_floattost...
Also it seems that Ryu prints some numbers in weird ways even though "nicer" representations exist: https://github.com/rust-lang/rust/issues/52811#issuecomment-408644826 https://github.com/rust-lang/rust/issues/52811#issuecomment-...
- StephanTLavavej 6y agoThat “weirdness” is just scientific notation, which the Ryu implementation always emits. It is “superficial” in the sense that it’s separate from the core algorithm. When I adapted it for C++17 charconv in MSVC, I implemented fixed, general, and “plain shortest” notation, which will print 0.3 there. (General notation follows C printf %g’s rules for switching between fixed and scientific; “plain shortest” notation selects the one that’s fewer characters, tiebreaking to prefer fixed).
- zX41ZdbW 6y agoIn ClickHouse* we patched Ryu to provide nicer representations and to have better performance for floats that appear to be integers. * https://github.com/ClickHouse/ClickHouse/pull/8542 https://github.com/ClickHouse/ClickHouse/pull/8542
- zX41ZdbW 6y agoThe change to Ryu is here: https://github.com/ClickHouse-Extras/ryu/pull/1 https://github.com/ClickHouse-Extras/ryu/pull/1