Skip to content

Lexical-Core Version 0.8.0 Release

Compare
Choose a tag to compare
@Alexhuszagh Alexhuszagh released this 03 Sep 14:03
· 57 commits to main since this release

This was a large release that Involved a near complete re-write of lexical for faster algorithms, a simpler internal design, and faster digit parsing implementations.

Options API

  • Added the Options API, a way to customize numeric conversions at runtime. The Options API is described in depth here, and contains the following structs:
    • ParseFloatOptions
    • ParseIntegerOptions
    • WriteFloatOptions
    • WriteIntegerOptions

Format API

  • Change NumberFormat to be a packed u128 struct to allow more extensive configuration and use const generics.
  • Changed NumberFormat to be an internal implementation detail, and NumberFormatBuilder to be the public API for creating custom formats at compile time.

Simplified the public API

  • Added parse_with_options, parse_partial_with_options.

  • Added write_with_options, write_unchecked, and write_with_options_unchecked.

  • Remove the write_format, write_radix, and similar functions.

  • Remove the parse_format, parse_radix, and similar functions.

  • Added a faster float writer and parser for power of 2 radixes.

  • Added the required_exponent_notation flag to NumberFormat.

  • Added the power-of-two feature, for conversion to and from strings with power-of-two bases.

  • Added the compact feature, optimized for binary size rather than performance.

  • Added extensive documentation on benchmarks, algorithms used, and internal implementation details.

Removal Features

  • Removed the dtoa feature. This allows only 1 compact backend and 1 performance backend, for fully additive features. The new Dragonbox algorithm is faster than any existing algorithms.
  • Removed the rounding feature. This was never used in practice.
  • Removed the lexical-capi. Existing, high-performance C/C++ libraries exist, so it's no longer practical.

Algorithm Improvements

  • Made the Eisel-Lemire algorithm the default float-parser, leading to substantial improvements in performance.
  • Made Dragonbox the default float writer.
  • Removed pre-computed float tables of powers-of-two, and recreated stable powers of 2 through bit manipulations.
  • Improved the algorithms to write and parse 128-bit integers, using faster division and multiplication algorithms.
  • Simplified the big-integer arithmetic, improving performance and simplifying maintenance for float parsing algorithms.

Other Changes

  • Updated the MSRV to 1.51.0.
  • Updated the benchmarks to note the significant algorithm changes.
  • Added automatic formatting via Rustfmt, linting via Clippy, as well as increased documentation of safety guarantees.
  • Added support for base prefixes and suffixes.
  • Reduced static storage required for extended-float algorithms.
  • Updated the fuzz handlers and conformance tests.
  • Refactored all numeric conversions into separate crates, using workspaces.

Bug Fixes

  • Fixed a bug with trailing digit separators in special values.