Skip to content

perf(decode): evaluate lexical crate for float parsing #21

@membphis

Description

@membphis

Background

src/decode/number.rs uses <f64>::from_str (via the standard library) to parse floating-point numbers. The standard library implementation is correct but not optimized for throughput; the lexical crate offers a significantly faster parser with the same correctness guarantees.

Proposal

Profile from_str against lexical::parse::<f64> on a representative mixed-payload bench (many numeric fields). If from_str is measurable in the profile, replace it with lexical-core (no-std compatible, no allocation).

Acceptance criteria

  • Benchmark shows lexical is faster in the target workload (many float fields).
  • cargo test --no-default-features still passes (lexical is scalar-safe).
  • No change to the external API or error semantics — QJD_PARSE_ERROR still returned on malformed numbers.

Notes

lexical-core is a popular, well-maintained crate used by serde_json and simd-json. Adding it is low-risk. If profiling shows from_str is not on the hot path for typical "parse + read 3 fields" workloads, close this as not worth the dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions