Skip to content

Investigate faster floating point parsing #133630

Open
@cor3ntin

Description

@cor3ntin

I was looking at some benchmarks and found out that we can spend a lot of time in
IEEEFloat::convertFromDecimalString (for the case of large arrays of floating points in source code)

Looking at that code, it seems that for at least some combination of rounding modes, semantics
and size, we could benefit from Lemire's algorithm.

We already ship that algorithm in libc, so hopefully we could reuse that.

https://github.com/llvm/llvm-project/blob/main/libc/src/__support/str_to_float.h

Assuming most floating-point literals are well-formed/short (do not represent a number that doesn't fit in a double), it would almost certainly be a great improvement to try Lemire first and fallback on the existing implementation for long doubles, etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"enhancementImproving things as opposed to bug fixing, e.g. new or missing featurefloating-pointFloating-point math

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions