[libc-commits] [llvm] [libc] [libc] Move printf long double to simple calc (PR #75414)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Fri Dec 22 01:17:47 PST 2023


================
@@ -87,14 +87,25 @@ are not recommended to be adjusted except by persons familiar with the Printf
 Ryu Algorithm. Additionally they have no effect when float conversions are
 disabled.
 
+LIBC_COPT_FLOAT_TO_STR_NO_SPECIALIZE_LD
+---------------------------------------
+This flag disables the separate long double conversion implementation. It is
+not based on the Ryu algorithm, instead generating the digits by
+multiplying/dividing the written-out number by 10^9 to get blocks. It's
+significantly faster than INT_CALC, only about 10x slower than MEGA_TABLE,
----------------
gchatelet wrote:

Cache wise the 5MiB table seems pretty bad for a function that can be called frequently on multiple cores.

The sheer size is an issue in itself but cache invalidation is also a concern, libc instruction and data footprint should be small to allow for more application state to stay in the cache. How is the table accessed by the way? Are the indices about always the same or is it completely random? Is there a way to compress the table? Can we come up with a smaller table and interpolate between values without losing precision?

https://github.com/llvm/llvm-project/pull/75414


More information about the libc-commits mailing list