[libc-commits] [PATCH] D113681: [libc] Simplify decimalStringToFloat and hexadecimalStringToFloat in str_to_float.h and improve their performance.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Nov 11 08:34:17 PST 2021

lntue created this revision.
lntue added reviewers: michaelrj, sivachandra.
Herald added subscribers: ecnelises, tschuett.
Herald added a project: libc-project.
lntue requested review of this revision.

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

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113681.386527.patch
Type: text/x-patch
Size: 5174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20211111/c02c6a2c/attachment.bin>

More information about the libc-commits mailing list