You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/09/07 04:37:45 UTC
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4785: Replace usage of `lexical-core crate` with libcore for parsing strings as floats
tustvold commented on code in PR #4785:
URL: https://github.com/apache/arrow-rs/pull/4785#discussion_r1318072902
##########
arrow-json/src/reader/primitive_array.rs:
##########
@@ -57,19 +57,31 @@ primitive_parse!(i8, i16, i32, i64, u8, u16, u32, u64);
impl ParseJsonNumber for f16 {
fn parse(s: &[u8]) -> Option<Self> {
- lexical_core::parse::<f32>(s).ok().map(f16::from_f32)
+ s.iter()
+ .map(|&b| b as char)
+ .collect::<String>()
Review Comment:
I suspect the performance hit of this allocation will be a non-starter. This could be reduced by using str::from_utf8, but this will still likely regress performance
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org