[libc-commits] [PATCH] D113036: [libc] refactor atof string parsing

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Nov 2 11:16:42 PDT 2021


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

Split the code for parsing hexadecimal floating point numbers from the
code for parsing the decimal floating point numbers so that the parsing
can be faster for both of them.

This decreases the time for the benchmark in release mode by about 5%,
which almost matches GLibc.

Old version: 2.299s
New version: 2.149s
GLibc: 2.133s

Tests run by running the following command 10 times for each version:
time ~/llvm-project/build/bin/libc_str_to_float_comparison_test ~/parse-number-fxx-test-data/data/*

the parse-number-fxx-test-data-repository is here:
https://github.com/nigeltao/parse-number-fxx-test-data/tree/fe94de252c691900982050c8e7c503d1efd1299a

It's important to build llvm-libc in Release mode for accurate
performance comparisons against glibc (set -DCMAKE_BUILD_TYPE=Release in
your cmake).
You also have to build the libc_str_to_float_comparison_test target.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113036

Files:
  libc/src/__support/str_to_float.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113036.384168.patch
Type: text/x-patch
Size: 16164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20211102/2ef591f4/attachment.bin>


More information about the libc-commits mailing list