Files
Nigel Tao 4d4c3c4c3c floatconv: tweak Simple Decimal Conversion
This tweaks the code and comments added in commit 36d7748e "Merge pull
request #90 from sarastro-nl/improvement/optimize-SDC" and commit
d46220ca "optimize SDC". Both of those two commit messages are short but
see the discussion re algorithmic changes on PR 87 (yes, 87, not 90):
https://github.com/google/wuffs/pull/87

Also run clang-format.

Also update doc/changelog.md

Compared to before commit d46220ca "optimize SDC", when running
script/manual-test-parse-number-f64.cc and disabling both the
etc__parse_number_f64_eisel_lemire function and the "If both man and
(10 ** exp10) are exactly representable by a double" fast path, the
tests still pass but the number of etc__high_prec_dec__small_lshift and
etc__high_prec_dec__small_rshift calls drop:

Function    Before      After       Ratio
lshift      31174584    25762258    82.64% = 100% - 17.36%
rshift      21592604    20982502    97.17% = 100% -  2.83%

The time taken drops from 15.984s to 13.710s (85.77% = 100% - 14.23%).

To repeat, these are the improvements after disabling the Eisel-Lemire
and other fast paths. Simple Decimal Conversion is the rarely invoked
fallback parse_number_f64 algorithm. The practical improvement (with
Eisel-Lemire etc enabled) is smaller.
2023-02-04 14:48:25 +11:00
..
2021-09-04 15:54:31 +10:00

C Base Code

This directory (base) and its sibling (auxiliary) contain C and C++ code respectively. This C/C++ code combines with the transpiled-to-C/C++ form of the Wuffs code in the top-level std directory to create the "single file C/C++ library" form of the Wuffs standard library.

  • From Wuffs-the-language's point of view, this directory contains implementations of the built-in base package types, such as I/O buffers, ranges and rects and statuses.
  • From application code's point of view (Wuffs is for writing libraries not applications), this directory also contains helper functions for working with those base types, such as constructing an I/O buffer from a pointer and a length, that aren't relevant to Wuffs-the-language code.
  • This directory also contains some functionality (e.g. pixel conversion and string conversion) that, in the future, could possibly be Wuffs packages under std. For optimal performance, they sometimes require programming language features (e.g. function-pointer typed variables, SIMD acceleration) that are not yet available in Wuffs-the-language (or were not available at the time they were added). In the short term, it was more practical to implement them in carefully hand-written C/C++, in this directory. In the long term, they could migrate out of base to be under std, but any base API removal would require a Wuffs version number bump.

Making Changes

After editing source code in this directory, to see those changes when generating the C/C++ form of Wuffs' standard library:

go install github.com/google/wuffs/cmd/wuffs-c && wuffs gen base

This should modify the wuffs-unsupported-snapshot.c file.