Commit Graph
28 Commits
Author SHA1 Message Date
Nigel Tao a1c22caa15 Rename load and store to peek and poke 2021-01-17 22:44:39 +11:00
Nigel Tao ce685a647d Fix hpd__small_rshift clobbering the negative bit
Also link to the Simple Decimal Conversion blog post.
2020-11-03 15:24:02 +11:00
Nigel Tao 1d8d18f400 Add link to Eisel-Lemire blog post 2020-10-07 22:13:51 +11:00
Nigel Tao ba3818cb6b Add more parse_number_f64 test cases 2020-09-28 12:51:45 +10:00
Nigel Tao 4f1d24c070 Add names to "typedef struct { ... } foo" types 2020-09-23 22:02:53 +10:00
Nigel Tao afe7f27ab7 Trim Eisel-Lemire powers-of-10 tables
This tracks the upstream github.com/lemire/fast_double_parser

On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

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

Binary size, before:
29544 gen/lib/c/clang-9-dynamic/wuffs-base-floatconv.lo
29648 gen/lib/c/clang-9-static/wuffs-base-floatconv.o
31192 gen/lib/c/gcc-dynamic/wuffs-base-floatconv.lo
31160 gen/lib/c/gcc-static/wuffs-base-floatconv.o

After:
27160 gen/lib/c/clang-9-dynamic/wuffs-base-floatconv.lo
27264 gen/lib/c/clang-9-static/wuffs-base-floatconv.o
28760 gen/lib/c/gcc-dynamic/wuffs-base-floatconv.lo
28760 gen/lib/c/gcc-static/wuffs-base-floatconv.o
2020-09-23 16:18:27 +10:00
Nigel Tao b6d855210c Use a formula to calculate Eisel-Lemire power-of-2
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ g++ -O3 script/process-json-numbers.c
$ time ./a.out -parse-number-f64 < citylots.json
Before/After:
real    0m0.992s
real    0m1.035s
2020-09-23 15:23:12 +10:00
Nigel Tao 0987296352 Fix parse_number_f64_eisel_lemire comment typos 2020-09-15 22:25:33 +10:00
Nigel Tao f2be4dd7cf Trim private_implementation__powers_of_10 array
Binary size, before:
30344 gen/lib/c/clang-9-dynamic/wuffs-base-floatconv.lo
30488 gen/lib/c/clang-9-static/wuffs-base-floatconv.o
31992 gen/lib/c/gcc-dynamic/wuffs-base-floatconv.lo
31992 gen/lib/c/gcc-static/wuffs-base-floatconv.o

After:
29512 gen/lib/c/clang-9-dynamic/wuffs-base-floatconv.lo
29656 gen/lib/c/clang-9-static/wuffs-base-floatconv.o
31160 gen/lib/c/gcc-dynamic/wuffs-base-floatconv.lo
31160 gen/lib/c/gcc-static/wuffs-base-floatconv.o
2020-09-15 22:14:30 +10:00
Nigel Tao 8b45db0120 Narrow parse_number_f64_eisel_lemire's exp10 arg
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ g++ -O3 script/process-json-numbers.c
$ time ./a.out -parse-number-f64 < citylots.json
Before/After:
real    0m0.995s
real    0m0.968s
2020-09-15 21:58:57 +10:00
Nigel Tao 339119a5c1 Simplify parse_number_f64's use of __uint128_t 2020-09-14 12:43:29 +10:00
Nigel Tao 9f22b5ebf7 Fix wuffs_base__parse_number_f64 fast path comment 2020-09-11 09:10:08 +10:00
Nigel Tao 57d47c633c Fix etc__high_prec_dec__to_f64 shift amount
Shifting 0.299 left by 2 doesn't put us in [½ .. 1].
2020-09-08 16:43:31 +10:00
Nigel Tao a4f2bbb249 Update cgen/base run "go generate" comment 2020-07-28 14:15:24 +10:00
Nigel Tao c4fa8e27c0 Rename the "Eisel" algorithm to "Eisel-Lemire" 2020-07-18 17:35:13 +10:00
Nigel Tao 56d9096f81 Fix -Werror=conversion in from_f64_to_u{16,32} 2020-07-12 21:11:49 +10:00
Nigel Tao a3931d5215 Rename IEEE 754 from_f64_to_u{16,32} functions 2020-07-12 21:06:44 +10:00
Nigel Tao 7bf7cf28b9 Add IEEE 754 from_f64_to_u{16,32} functions 2020-07-12 17:01:14 +10:00
Nigel Tao 4d449dc663 Rename ieee_754_bit_representation functions 2020-07-12 11:00:47 +10:00
Nigel Tao c5c9885db4 Add PARSE_NUMBER_XXX__ALLOW_UNDERSCORES 2020-07-11 13:10:14 +10:00
Nigel Tao e82bc8ec7b Add PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_Z... 2020-07-11 12:57:25 +10:00
Nigel Tao 4d61a056e0 Add PARSE_NUMBER_FXX__REJECT_INF_AND_NAN 2020-07-11 12:34:40 +10:00
Nigel Tao e0c5de9d8d Add PARSE_NUMBER_FXX__DECIMAL_SEPARATOR_IS_A_COMMA 2020-07-11 12:14:39 +10:00
Nigel Tao e722bb095c Fix #ifdef guarding the use of __uint128_t 2020-07-10 20:33:09 +10:00
Nigel Tao bff01d7ea8 Add comment linking to previous commit's numbers 2020-07-10 12:15:09 +10:00
Nigel Tao 18449ad75d Optimize 128-bit muls in parse_number_f64_eisel
Processing citylots.json from github.com/zemirco/sf-city-lots-json
$ cc -O3 script/process-json-numbers.c
$ time ./a.out --parse-number-f64 < citylots.json

gcc   9.3 Before/After
real    0m0.638s
real    0m0.609s

clang 9.0 Before/After
real    0m0.692s
real    0m0.685s

x86_64 Broadwell desktop CPU.
2020-07-10 12:11:26 +10:00
Nigel Tao 74d4af66e4 Refactor 128-bit muls in parse_number_f64_eisel 2020-07-10 11:27:17 +10:00
Nigel Tao ca55cdbef0 Rename {f64,i64}conv to {float,int}conv 2020-07-09 21:15:36 +10:00