Refine parse_number_f64's powers_of_10 table

Refine means changing the base-10 exponents from "-348 ..= +340 stepping
by 8" to "-326 ..= +310 stepping by 1".

Binary size, before:
15992 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
16232 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
17384 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
17384 gen/lib/c/gcc-static/wuffs-base-f64conv.o

After:
22232 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
22408 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
23816 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
23816 gen/lib/c/gcc-static/wuffs-base-f64conv.o

$ g++ -O3 script/process-json-numbers.c
$ time ./a.out -parse-number-f64 < citylots.json
Before/After:
real	0m1.455s
real	0m1.432s

citylots.json is from github.com/zemirco/sf-city-lots-json
This commit is contained in:
Nigel Tao committed 2020-07-05 13:58:49 +10:00
1 parent fc1b33a0ff
commit 53da68fe4b
5 files changed
+1368 -230

No files matched your search

+3 -3
View File
@@ -448,10 +448,10 @@ test_wuffs_strconv_mpb_assign_from_hpd() {
.want_exp2 = -77,
.want_f64 = .0001},
// (0xCCCCCCCCCCCCCCCD * (2 ** -67)) is roughly .1
// (0xCCCCCCCCCCCCCCCE * (2 ** -67)) is roughly .1
{.str = "1",
.decimal_point = +0,
.want_mantissa = 0xCCCCCCCCCCCCCCCD,
.want_mantissa = 0xCCCCCCCCCCCCCCCE,
.want_exp2 = -67,
.want_f64 = .1},
@@ -472,7 +472,7 @@ test_wuffs_strconv_mpb_assign_from_hpd() {
// (0xC9F2C9CD04674EDE * (2 ** +36)) is roughly 1e30.
{.str = "1",
.decimal_point = +31,
.want_mantissa = 0xC9F2C9CD04674EDE,
.want_mantissa = 0xC9F2C9CD04674EE0,
.want_exp2 = +36,
.want_f64 = 1e30},