Commit Graph
430 Commits
Author SHA1 Message Date
Nigel Tao c4ce7ae6c7 Add "NIE Tests" comment 2020-12-26 22:02:46 +11:00
Nigel Tao 4ff1429553 Add std/png filter_and_swizzle 2020-12-25 18:35:19 +11:00
Nigel Tao 58c30e9d6d Add std/png 2020-12-24 13:10:29 +11:00
Nigel Tao 1197e86616 Add std/nie 2020-12-23 14:53:56 +11:00
Nigel Tao 5a387fe090 Swizzler support for src_pixfmt = RGB|A_NONPREMUL
Binary size, before:
21520 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
22536 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
34488 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
34408 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
25712 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
26800 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
42816 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
42768 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2020-12-20 21:50:37 +11:00
Nigel Tao 9399c82409 Have non-animated image decoders give EOD earlier 2020-12-19 22:03:22 +11:00
Nigel Tao 695a6815b1 Remove gif.config_decoder
The original motivation (having a low-featured low-memory decoder just
for counting GIF frames) is obsolete: https://crbug.com/1132828

Binary size, before:
42264 gen/lib/c/clang-9-dynamic/wuffs-std-gif.lo
42392 gen/lib/c/clang-9-static/wuffs-std-gif.o
44824 gen/lib/c/gcc-dynamic/wuffs-std-gif.lo
45624 gen/lib/c/gcc-static/wuffs-std-gif.o

After:
26736 gen/lib/c/clang-9-dynamic/wuffs-std-gif.lo
26712 gen/lib/c/clang-9-static/wuffs-std-gif.o
27976 gen/lib/c/gcc-dynamic/wuffs-std-gif.lo
28392 gen/lib/c/gcc-static/wuffs-std-gif.o
2020-12-18 22:06:08 +11:00
Nigel Tao ac930b801b Swizzler support for src_pixfmt = BGRX
Binary size, before:
18520 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
19200 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
30256 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
30192 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
20440 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
21200 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
33424 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
33384 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2020-11-16 21:51:42 +11:00
Nigel Tao 4a5df43aeb Add PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE
Binary size, before:
14272 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
14760 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
22336 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
22280 gen/lib/c/gcc-static/wuffs-base-pixconv.o

After:
18712 gen/lib/c/clang-9-dynamic/wuffs-base-pixconv.lo
19392 gen/lib/c/clang-9-static/wuffs-base-pixconv.o
36880 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
36824 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2020-11-16 15:23:57 +11:00
Nigel Tao ba3818cb6b Add more parse_number_f64 test cases 2020-09-28 12:51:45 +10:00
Nigel Tao cd4cbc9102 Tweak JSON trailing comment/new-line quirks 2020-09-22 23:03:49 +10:00
Nigel Tao fa50f4de67 Add json QUIRK_ALLOW_TRAILING_COMMENT 2020-09-21 11:24:22 +10:00
Nigel Tao ddac2c50ee Add more {parse,render}_number_f64 test cases 2020-09-15 21:17:33 +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 6c13877688 Drop WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_BYTES
We can always add it back later if there's demand for it.
2020-08-30 16:15:35 +10:00
Nigel Tao 0091a2132d Have std/cbor reject tags before an 0xFF stop code 2020-08-10 21:39:37 +10:00
Nigel Tao 9497b174c9 Add test_wuffs_cbor_decode_{in,}valid 2020-08-10 21:22:47 +10:00
Nigel Tao 1adbc9547f Split std/json's QUIRK_ALLOW_BACKSLASH_X in two 2020-08-06 23:28:07 +10:00
Nigel Tao 1e96ef200c Add test/data/cbor-rfc-7049-examples.* 2020-07-27 22:00:28 +10:00
Nigel Tao d6a10dfe8a Add io_buffer.{read,writ}er_slice methods 2020-07-27 11:47:47 +10:00
Nigel Tao 702c7b299f Let wuffs_base__utf_8__etc take ptr-to-const-u8 2020-07-22 15:42:54 +10:00
Nigel Tao 4e193599ac Add std/cbor 2020-07-15 14:08:37 +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 0899b82c42 Add IEEE 754 from_u{16,32}_to_f64 functions 2020-07-12 13:23:04 +10:00
Nigel Tao 4d449dc663 Rename ieee_754_bit_representation functions 2020-07-12 11:00:47 +10:00
Nigel Tao 0a9075f81c Move test_wuffs_strconv_parse_number_f64_options 2020-07-11 13:17:58 +10:00
Nigel Tao 37bc8cdaa5 Refactor parse_number_f64 related tests 2020-07-11 13:16:00 +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 e0ca5a4c3c Have base_16 codec return a transform__output 2020-07-09 21:09:19 +10:00
Nigel Tao 309a5ba231 Add base_64 codec to wuffs_base 2020-07-09 20:42:17 +10:00
Nigel Tao 84bb3afd87 Lower json.DECODER_NUMBER_LENGTH_MAX_INCL to 99
Commit b9f69264a0 "Raise
json.DECODER_NUMBER_LENGTH_MAX_INCL to 2047" might have regressed the
std/json benchmarks.
2020-07-07 23:29:30 +10:00
Nigel Tao b9f69264a0 Raise json.DECODER_NUMBER_LENGTH_MAX_INCL to 2047 2020-07-07 23:08:11 +10:00
Nigel Tao 6b7ce30e32 Add wuffs_base__parse_number_xxx options arg 2020-07-07 16:19:46 +10:00
Nigel Tao 832edf7227 Remove the medium_prec_bin type
It's obsolete now that we have an Eisel algorithm implementation.

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

After:
28744 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
28968 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
31176 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
31176 gen/lib/c/gcc-static/wuffs-base-f64conv.o

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.031s
real	0m0.975s
$ time ./a.out                   < citylots.json
Before/After:
real    0m0.807s
real	0m0.729s
2020-07-07 16:07:35 +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 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 58678cb342 Add wuffs_base__render_number_f64 benches 2020-07-03 23:16:53 +10:00
Nigel Tao b9afc26387 Add TOKEN__VBD__STRING__CHAIN_ETC 2020-07-03 13:36:13 +10:00
Nigel Tao a6031b6d2e Add wuffs_base__utf_8__next_from_end 2020-07-02 15:08:54 +10:00
Nigel Tao 89ceb9fabc Add wuffs_base__render_number_f64 2020-07-01 12:03:20 +10:00
Nigel Tao d40a386211 Add wuffs_base__render_number_{i,u}64 2020-06-21 21:57:48 +10:00
Nigel Tao f45f01f4f3 Update clang-format from v5 to v9 2020-06-05 14:06:56 +10:00
Nigel Tao d7c9e9bbc9 De-duplicate the wuffs_gif_decode test function 2020-06-01 14:33:19 +10:00
Nigel Tao e6b7c51557 Inline do_bench_gif_decode 2020-06-01 14:23:59 +10:00