[all-commits] [llvm/llvm-project] 499ca8: [libc] Simplify decimalStringToFloat and hexadecim...

lntue via All-commits all-commits at lists.llvm.org
Thu Nov 11 15:35:27 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 499ca806dcfb5f5c842fb240e150140fb15011ed
      https://github.com/llvm/llvm-project/commit/499ca806dcfb5f5c842fb240e150140fb15011ed
  Author: Tue Ly <lntue at google.com>
  Date:   2021-11-11 (Thu, 11 Nov 2021)

  Changed paths:
    M libc/src/__support/str_to_float.h

  Log Message:
  -----------
  [libc] Simplify decimalStringToFloat and hexadecimalStringToFloat and improve their performance.

Combine two loops in decimalStringToFloat and hexadecimalStringToFloat that extract the digits and re-arrange them a little bit.  This slightly improves the performance of strtof and strtod:
Running libc_str_to_float_comparison_test parse-number-fxx-test_data/data/* on my machine (Ryzen 1700)
- with glibc: ~1.92 seconds
- with current implementation: ~1.78 seconds
- with this change: ~1.67 seconds

Differential Revision: https://reviews.llvm.org/D113681




More information about the All-commits mailing list