aldanor / fast-float-rust

Super-fast float parser in Rust (now part of Rust core)
https://docs.rs/fast-float
Apache License 2.0
275 stars 20 forks source link

already merged into std? #34

Closed evbo closed 2 years ago

evbo commented 2 years ago

Hi,

I'm curious if it's still worth it using this crate or hasn't std already merged in this code according to?: https://github.com/rust-lang/rust/pull/86761

So just doing f32::from_str(the_str).unwrap() should get the float parsed fast now with Lemire algorithm right?

aldanor commented 2 years ago

Yep, it has been pretty much fully integrated into the std now! (perhaps it should be clarified in the readme)

This crate has served its purpose as a transitional step towards having the fast-float algorithm in the std, with various details and corner cases polished here performance-wise; it may still be useful though under older rustc versions.

Alexhuszagh commented 2 years ago

@evbo The partial parser is also useful, since the if you have input where you don't want to first identify the valid part of the float then parse (due to performance hits or just implementing the internal logic), the partial parser is still very useful.

evbo commented 2 years ago

@Alexhuszagh got it, so if there's a near zero percent chance of someone typing an invalid float number (in some file I'm parsing) then I could use this for a speed up. Why didn't the partial parser get merged into std?

Alexhuszagh commented 2 years ago

@evbo It would require an RFC, which is a relatively long process, and there are concerns of too many methods being introduced into std for what is a relatively niche case, with good third party libraries available (both this, and my own).

I hope this makes sense? There were discussions of merging the partial parser but they went nowhere (at least with the amount of effort I was willing to put in, someone else might be able to convince the language design team this is a good idea if they are willing to put in the effort).