From 9baa34d65d9ec79a7eefd2546c04b9b9ebd3c525 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 14 Sep 2019 18:04:01 -0500 Subject: [PATCH] Added a comment to parsing number literals --- src/parse/number_literal.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parse/number_literal.rs b/src/parse/number_literal.rs index c0d617f584..bfefdef0c0 100644 --- a/src/parse/number_literal.rs +++ b/src/parse/number_literal.rs @@ -109,11 +109,20 @@ where f64_buf.push('.'); f64_buf.push_str(&after_decimal); + // TODO [convert this comment to an issue] - we can get better + // performance here by inlining string.parse() for the f64 case, + // since we've already done the work of validating that each char + // is a digit, plus we also already separately parsed the minus + // sign and dot. match f64_buf.parse::() { Ok(float) if float.is_finite() => Expr::Float(float), _ => Expr::MalformedFloat(Problem::OutsideSupportedRange), } } else { + // TODO [convert this comment to an issue] - we can get better + // performance here by inlining string.parse() for the i64 case, + // since we've already done the work of validating that each char + // is a digit. match before_decimal.parse::() { Ok(int_val) => Expr::Int(int_val), Err(_) => Expr::MalformedInt(Problem::OutsideSupportedRange),