Commit Graph
156 Commits
Author SHA1 Message Date
Nigel Tao c9d4e34dfc Split ETC__VBC__INLINE_INTEGER into {,un}signed 2020-07-21 15:31:49 +10:00
Nigel Tao 4e193599ac Add std/cbor 2020-07-15 14:08:37 +10:00
Nigel Tao fcb6416c16 Add script/extract-cbor-rfc-7049-examples.go 2020-07-10 22:56:47 +10:00
Nigel Tao 27766aedf9 Let process-json-numbers use fast_double_parser 2020-07-09 10:59:54 +10:00
Nigel Tao 6b7ce30e32 Add wuffs_base__parse_number_xxx options arg 2020-07-07 16:19:46 +10:00
Nigel Tao 86093c8194 Have parse_number_f64 use the Eisel algorithm
The algorithm is discussed at
https://lemire.me/blog/2020/03/10/fast-float-parsing-in-practice/

----

Binary size, before:
27848 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
28040 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
30392 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
30392 gen/lib/c/gcc-static/wuffs-base-f64conv.o

After:
29416 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
29688 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
31792 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
31792 gen/lib/c/gcc-static/wuffs-base-f64conv.o

The binary size difference does not account for the powers-of-10 table,
which was expanded in a previous commit in anticipation of this one. A
future commit will also remove some of the other f64 parser code used
before implementing the Eisel algorithm.

----

Processing citylots.json 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.231s
real	0m1.031s

The difference with and without -parse-number-f64 measures how much time
is spent in the parse_number_f64 function. Before: 424ms, after: 224ms.
$ time ./a.out                   < citylots.json
real	0m0.807s

Similarly, for canada.json from github.com/miloyip/nativejson-benchmark
$ time ./a.out -parse-number-f64 < canada.json
Before/After:
real	0m0.023s
real	0m0.017s
$ time ./a.out                   < canada.json
real	0m0.013s
Time spent in parse_number_f64, before: 10ms, after: 4ms.

----

name                                                old time/op  new time/op   delta
wuffs_strconv_parse_number_f64_1_lsh53_add0/clang5  77.0ns ± 0%   37.0ns ± 0%  -51.95%  (p=0.029 n=4+4)
wuffs_strconv_parse_number_f64_1_lsh53_add1/clang5   690ns ± 0%    725ns ± 2%   +4.95%  (p=0.008 n=5+5)
wuffs_strconv_parse_number_f64_pi_long/clang5       92.0ns ± 0%  136.0ns ± 2%  +47.83%  (p=0.016 n=4+5)
wuffs_strconv_parse_number_f64_pi_short/clang5      35.0ns ± 3%   18.0ns ± 0%  -48.57%  (p=0.008 n=5+5)
wuffs_strconv_parse_number_f64_1_lsh53_add0/gcc7    67.0ns ± 0%   34.0ns ± 0%  -49.25%  (p=0.000 n=5+4)
wuffs_strconv_parse_number_f64_1_lsh53_add1/gcc7     712ns ± 0%    760ns ± 2%   +6.72%  (p=0.008 n=5+5)
wuffs_strconv_parse_number_f64_pi_long/gcc7         88.4ns ± 1%  116.2ns ± 3%  +31.45%  (p=0.008 n=5+5)
wuffs_strconv_parse_number_f64_pi_short/gcc7        32.6ns ± 2%   21.4ns ± 7%  -34.36%  (p=0.008 n=5+5)
2020-07-07 15:27:51 +10:00
Nigel Tao 1bc98b6035 Fix script/print-mpb-powers-of-10.go with -detail 2020-07-06 17:01:41 +10:00
Nigel Tao 267bfc8176 Deepen parse_number_f64's powers_of_10 table
Deepen means changing the mantissa from 64 bits to 128 bits. We also
adjust the exponent bias, in anticipation of a future commit.

Binary size, before:
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

After:
27336 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
27528 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
28856 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
28856 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.432s
real	0m1.421s

citylots.json is from github.com/zemirco/sf-city-lots-json
2020-07-05 19:03:37 +10:00
Nigel Tao 53da68fe4b 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
2020-07-05 13:58:49 +10:00
Nigel Tao 19b3ce24a3 Optimize high_prec_dec__round_just_enough
name                                                               old time/op  new time/op  delta
wuffs_strconv_render_number_f64_just_enough_fractions/clang5       56.4µs ± 1%  56.3µs ± 1%     ~     (p=1.000 n=5+5)
wuffs_strconv_render_number_f64_just_enough_small_integers/clang5  4.12µs ± 2%  1.00µs ± 1%  -75.65%  (p=0.008 n=5+5)
wuffs_strconv_render_number_f64_just_enough_fractions/gcc7         54.3µs ± 0%  54.2µs ± 0%     ~     (p=0.151 n=5+5)
wuffs_strconv_render_number_f64_just_enough_small_integers/gcc7    4.16µs ± 0%  1.01µs ± 0%  -75.77%  (p=0.000 n=4+5)
2020-07-03 23:44:37 +10:00
Nigel Tao 0eee231ce6 Add script/process-json-numbers.c 2020-07-03 12:48:37 +10:00
Nigel Tao 89ceb9fabc Add wuffs_base__render_number_f64 2020-07-01 12:03:20 +10:00
Nigel Tao f7ea462c00 Fix human-readable vmajor when out of base38 range 2020-04-10 22:44:13 +10:00
Nigel Tao 496e88b6c5 Remove wuffs_base__token__link_prev 2020-04-09 22:11:08 +10:00
Nigel Tao 3385efa7fd Update token debug format for extended tokens 2020-04-02 12:10:10 +11:00
Nigel Tao d587c9e4fa Add medium-precision-binary floating point impl
name                                          old time/op   new time/op   delta

strconv_parse_number_f64_1_lsh53_add0/clang5    218ns ± 1%    100ns ± 0%  -54.13%  (p=0.016 n=5+4)
strconv_parse_number_f64_1_lsh53_add1/clang5    716ns ± 2%    741ns ± 1%   +3.46%  (p=0.008 n=5+5)
strconv_parse_number_f64_pi_long/clang5         438ns ± 2%    153ns ± 1%  -65.19%  (p=0.008 n=5+5)
strconv_parse_number_f64_pi_short/clang5        174ns ± 2%     62ns ± 2%  -64.37%  (p=0.008 n=5+5)

strconv_parse_number_f64_1_lsh53_add0/gcc7      221ns ± 1%     97ns ± 4%  -56.25%  (p=0.008 n=5+5)
strconv_parse_number_f64_1_lsh53_add1/gcc7      742ns ± 1%    757ns ± 0%   +2.02%  (p=0.008 n=5+5)
strconv_parse_number_f64_pi_long/gcc7           477ns ± 1%    151ns ± 3%  -68.40%  (p=0.008 n=5+5)
strconv_parse_number_f64_pi_short/gcc7          191ns ± 1%     55ns ± 0%  -71.14%  (p=0.000 n=5+4)
2020-03-31 22:18:54 +11:00
Nigel Tao c0bd9df978 Have script/*.c global var names start with g_ 2020-03-26 21:55:44 +11:00
Nigel Tao f3146c2ea9 Add base.token_decoder.workbuf_len 2020-03-26 08:47:42 +11:00
Nigel Tao 3bfed6d812 Rename std/json quirk_replace_invalid_utf_8 2020-03-24 17:44:47 +11:00
Nigel Tao 5d5a17cc9c Add test/data/json-quirks.json 2020-03-24 17:13:07 +11:00
Nigel Tao a3827275c0 Add std/json quirks 2020-03-12 16:47:26 +11:00
Nigel Tao 499ca132f6 Add wuffs_base__parse_number_f64 2020-03-11 11:41:32 +11:00
Nigel Tao fdac24a425 Rename FOO_BUFFER_SIZE to FOO_BUFFER_ARRAY_SIZE 2020-03-06 21:53:08 +11:00
Nigel Tao 6892095998 Have C programs handle flags consistently 2020-03-03 11:25:18 +11:00
Nigel Tao 6b29f32564 Add script/print-json-token-debug-format.c -a flag 2020-02-29 17:05:24 +11:00
Nigel Tao 85fba7f82b Tweak wuffs_base__token bitmask assignments again 2020-02-29 16:28:06 +11:00
Nigel Tao 67f00c15db Add script/print-json-token-debug-format.c -h flag 2020-02-29 16:13:11 +11:00
Nigel Tao d1c928a1ed Have tokens include explicit link bits 2020-02-29 10:46:44 +11:00
Nigel Tao 1ad5cfac4d Make wuffs_base__{load,store}_uNNxe public 2020-02-27 10:58:14 +11:00
Nigel Tao 193527bd2d Add script/print-json-token-debug-format.c 2020-02-26 22:47:31 +11:00
Nigel Tao 2914bae3b2 Re-format C function signatures 2020-02-26 09:40:30 +11:00
Nigel Tao a540fbce4e Add test/data/file-sizes.json 2020-02-25 16:05:38 +11:00
Nigel Tao 569a294fc2 Add script/run-json-test-suite.sh 2020-02-24 09:45:05 +11:00
Nigel Tao 1aa501632f Add gif.config_decoder (part 1 of 2)
This commit (part 1) adds script/preprocess-wuffs.go but running it is
deferred for part 2. Part 1 makes no change to the C code (release/c/**
and test/c/**).
2020-02-05 17:22:09 +11:00
Nigel Tao 621bd9505d Add script/draw-with-mask.go 2020-01-24 10:01:43 +11:00
Nigel Tao 3128500e20 Add script/convert-png-to-wbmp.go 2020-01-16 12:32:38 +11:00
Nigel Tao 6a90728bc9 Build fix for hand-written decode_huffman_fast 2020-01-11 10:21:25 +11:00
Nigel Tao 5f8d2da74f Rename decode_io_writer methods to transform_io 2020-01-11 10:19:25 +11:00
Nigel Tao 0152bd9ef4 Add script/print-markdown-links.go 2019-12-11 16:07:23 +11:00
Nigel Tao de60610741 Add script/print-byte-frequencies.go 2019-10-26 08:09:18 +11:00
Nigel Tao e384a0b387 Have script/bench-go-gif load files less often 2019-10-20 14:26:25 +11:00
Nigel Tao a9576964fd Add script/bench-go-deflate 2019-10-20 14:21:09 +11:00
Nigel Tao 4fc6d2af7b Avoid script/bench-go-gif variable shadowing 2019-10-20 14:20:06 +11:00
Nigel Tao b56d7c393a Fix script/bench-rust-deflate typo 2019-10-20 14:06:04 +11:00
Nigel Tao e442d4593c Add num_want_bytes to script/bench-rust-gif 2019-10-20 12:10:09 +11:00
Nigel Tao 29c23cd505 Add a warm-up rep to script/bench-rust-gif 2019-10-20 12:03:14 +11:00
Nigel Tao 135f706b3e Add script/bench-rust-deflate 2019-10-20 11:35:29 +11:00
Nigel Tao d2b0e1c203 Refine script/bench-rust-gif crates.io URL 2019-10-20 10:35:51 +11:00
Nigel Tao 078d8a6b9c Have script/bench-rust-gif print the rustc version 2019-10-20 10:30:29 +11:00
Nigel Tao ffdce5ef18 Have bench-rust-gif process animated / RGBA images 2019-10-16 16:42:51 +11:00