Commit Graph
150 Commits
Author SHA1 Message Date
Nigel Tao 4dfd70928b std: add "get_quirk(key: u32) u64" 2023-07-16 12:04:09 +10:00
Nigel Tao 8916f1b6ea lang: add if.likely and if.unlikely 2023-06-20 18:00:48 +10:00
Nigel Tao 19f56ebfd2 lang: allow "slice_var as ptr array[etc] etc" 2023-06-13 22:38:25 +10:00
Nigel Tao 0904751e2d example: add toy-aux-image 2023-06-04 10:47:22 +10:00
Nigel Tao 85b244aa49 std/netpbm: add new package 2023-05-16 16:29:58 +10:00
Nigel Tao 0bbc4c0083 std/jpeg: add new package
This is just a placeholder decoder implementation (and all of the
required plumbing) that produces a 1x1 reddish-purple image. Follow-up
commits will add flesh to the metaphorical bones.

Updates #42
2023-04-21 18:33:00 +10:00
Nigel Tao bc86394bef base: rename min/max arg to no_more/less_than 2023-04-16 12:12:27 +10:00
Nigel Tao e126c998e0 std: limit supported image dimensions to 0xFF_FFFF 2023-04-16 08:57:55 +10:00
Nigel Tao d8c23a3a66 std/lzw: change set_literal_width to set_quirk 2023-04-15 09:59:40 +10:00
Nigel Tao 6e84987d33 std: change set_quirk_enabled to set_quirk 2023-04-14 21:42:15 +10:00
Nigel Tao f3caf09d77 lang: add read-only type decorators 2023-04-10 15:29:12 +10:00
Nigel Tao 49fa501f0d lang/parse: struct private data now needs a "+" 2023-04-09 15:45:06 +10:00
Nigel Tao f5eb38d76e wuffsfmt: indent with 4 spaces (not a tab) 2023-04-09 15:28:07 +10:00
Nigel Tao 9c03b8c71d wuffsfmt: double-indents hanging lines 2023-04-09 15:22:25 +10:00
Nigel Tao d910658bce wuffs gen -version=0.3.3 2023-04-08 14:57:52 +10:00
Nigel Tao 00d5e35865 floatconv: optimize parse_number_f64 fallback
The time taken running script/manual-test-parse-number-f64.cc on the
parse-number-fxx-test-data suite falls from 3.565s to 2.491s (a 1.43x
ratio; the inverse is 0.70 = 100% - 30%).

Fixes #113
2023-04-08 14:56:32 +10:00
Nigel Tao 67d9a68c49 Update doc/changelog.md for v0.3.2 2023-04-07 13:52:02 +10:00
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
Nigel Tao 48e69da5af std/lzw: add "#truncated input" error
name                                         old speed      new speed      delta

wuffs_gif_decode_1k_bw/clang11                659MB/s ± 0%   748MB/s ± 0%  +13.43%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang11   182MB/s ± 0%   178MB/s ± 0%   -2.17%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang11   223MB/s ± 0%   219MB/s ± 0%   -2.00%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang11             799MB/s ± 0%   795MB/s ± 0%   -0.52%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang11          211MB/s ± 0%   210MB/s ± 0%   -0.47%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang11                  250MB/s ± 1%   254MB/s ± 0%   +1.75%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang11      581MB/s ± 0%   568MB/s ± 0%   -2.09%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang11       221MB/s ± 0%   221MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_gif_decode_1000k_full_init/clang11      222MB/s ± 0%   224MB/s ± 0%   +0.65%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang11      223MB/s ± 0%   224MB/s ± 0%   +0.58%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang11      1.28GB/s ± 0%  1.30GB/s ± 0%   +1.45%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc10                  595MB/s ± 0%   642MB/s ± 0%   +7.91%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10     168MB/s ± 0%   169MB/s ± 0%   +0.36%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10     202MB/s ± 0%   203MB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10               790MB/s ± 0%   798MB/s ± 0%   +1.04%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10            208MB/s ± 0%   210MB/s ± 0%   +1.00%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                    258MB/s ± 0%   266MB/s ± 0%   +3.08%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10        566MB/s ± 0%   577MB/s ± 0%   +1.83%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10         220MB/s ± 0%   227MB/s ± 0%   +3.03%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc10        223MB/s ± 0%   231MB/s ± 0%   +3.23%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10        224MB/s ± 0%   231MB/s ± 0%   +3.14%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10        1.30GB/s ± 0%  1.32GB/s ± 0%   +1.70%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/clang11                  294MB/s ± 0%   321MB/s ± 0%   +9.11%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang11                 533MB/s ± 0%   560MB/s ± 0%   +5.13%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc10                    271MB/s ± 0%   272MB/s ± 0%   +0.55%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc10                   527MB/s ± 0%   521MB/s ± 0%   -1.31%  (p=0.008 n=5+5)

Updates #96
2023-01-31 20:18:53 +11:00
Nigel Tao c698d81b4d Update README.md, doc/changelog.md 2023-01-26 17:17:12 +11:00
Nigel Tao ce8d08598d Add std/bzip2 package
This is just a placeholder decoder implementation.
2022-05-12 23:52:12 +10:00
Nigel Tao 14f5859311 Prohibit iterate loops inside coroutines 2022-01-25 15:22:56 +11:00
Nigel Tao 4c09c77bb9 Add std/tga package
This is just a placeholder decoder implementation  (and all of the
required plumbing) that produces a 1x1 reddish-purple image. Follow-up
commits will add flesh to the metaphorical bones.

TGA has no magic identifier, so MIME sniffers have to use heuristics.
The test/data/cbor-rfc-7049-examples.cbor file (which is CBOR binary
data, not a TGA image) is mistakenly sniffed as TGA. The /usr/bin/file
program makes the same classification (a false positive).

$ file test/data/cbor-rfc-7049-examples.cbor
test/data/cbor-rfc-7049-examples.cbor: Targa image data - Map 59395 x 26
x 15 +6169 +6500 - 2-bit alpha - interleave "@\033"

Some test/3pdata/tgasuite/*.tga test files, which are invalid TGA
images, are also false positives for now.

Updates #67
2022-01-14 22:53:20 +11:00
Nigel Tao 4e85543d9c Change default -ccompilers to "clang,gcc"
Updates #62
2021-12-30 19:29:44 +11:00
Nigel Tao 9323549eeb Update doc/changelog.md 2021-10-15 16:34:04 +11:00
Nigel Tao 81ba41e251 Add slice uintptr_low_12_bits method 2021-02-13 17:19:35 +11:00
Nigel Tao 8c4c714ad1 Add 0b prefixed binary numbers 2021-01-28 21:54:06 +11:00
Nigel Tao 78da50820e Rename set_ignore_checksum! as a quirk 2021-01-21 22:52:11 +11:00
Nigel Tao 26a7280900 Add slice base.u8 peek/poke methods
wuffs_png_decode_filter_1_sub/clang9  4.59GB/s ± 0%   4.59GB/s ± 0%      ~     (p=0.151 n=5+5)
wuffs_png_decode_filter_1_sub/gcc10   1.85GB/s ± 0%   4.11GB/s ± 0%  +122.24%  (p=0.016 n=5+4)
2021-01-17 23:47:37 +11:00
Nigel Tao a1c22caa15 Rename load and store to peek and poke 2021-01-17 22:44:39 +11:00
Nigel Tao 020b8e6903 Add cpu_arch 2021-01-15 10:26:55 +11:00
Nigel Tao 79b39e14bf Add SIMD
wuffs_pixel_swizzler_bgra_premul_y_src/clang9  1.94GB/s ± 1%  12.08GB/s ± 0%  +521.63%  (p=0.008 n=5+5)
wuffs_pixel_swizzler_bgra_premul_y_src/gcc10   2.92GB/s ± 0%  16.00GB/s ± 0%  +448.86%  (p=0.008 n=5+5)
2021-01-13 15:22:15 +11:00
Nigel Tao a1a70da539 Add iterate advance parameter 2021-01-11 00:03:44 +11:00
Nigel Tao 81c6437e09 Add choosy 2021-01-04 23:20:41 +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 e80ab7b13a Add doc/logo 2020-10-26 15:28:37 +11:00
Nigel Tao 6069ebd619 Rename {read,writ}er_io_position 2020-08-27 23:32:53 +10:00
Nigel Tao 592560e0f1 Upgrade default clang C compiler from v5 to v9 2020-08-21 14:18:26 +10:00
Nigel Tao be8542e313 Rename I/O available methods to length 2020-08-13 23:26:08 +10:00
Nigel Tao 0b7eaf291b Add example/cbor-to-json 2020-08-09 23:03:42 +10:00
Nigel Tao 724ce98540 Update some refs to the old aux directory name 2020-08-06 09:17:54 +10:00
Nigel Tao cf8884d44c Rename example/library to example/toy-genlib 2020-08-05 11:55:51 +10:00
Nigel Tao f557dad608 Add example/json-to-cbor 2020-08-04 23:45:46 +10:00
Nigel Tao cf6c578973 Add aux library 2020-08-04 23:43:38 +10:00
Nigel Tao 4e193599ac Add std/cbor 2020-07-15 14:08:37 +10:00
Nigel Tao a0f7059eeb Tweak changelog bullet for C formatting 2020-06-05 10:46:42 +10:00
Nigel Tao 8cd39fc1dd Remove -cformatter flag 2020-06-05 00:08:05 +10:00
Nigel Tao 12b0f4c0bc Change the default -cformatter to dumbindent
A follow-up commit will remove the -cformatter flag entirely.

Formatting the generated C code is now a small fraction of where "wuffs
gen" spends its time.

----
$ # Before.
$ time wuffs gen > /dev/null
real	0m0.932s
user	0m0.837s
sys	0m0.187s

$ # After.
$ time wuffs gen > /dev/null
real	0m0.186s
user	0m0.170s
sys	0m0.069s

$ time wuffs gen -cformatter= > /dev/null
real	0m0.184s
user	0m0.170s
sys	0m0.059s
----
2020-06-04 23:59:20 +10:00
Nigel Tao 829519880a Drop unnecessary memcpy in do_bench_image_decode
This doesn't affect the std/bmp or std/gif implementations per se, only
the code that benches them. Prior to this commit, the source file was
first decoded into a pixel buffer and then always copied from the
(2-dimensional) wuffs_base__pixel_buffer to a (1-dimensional)
wuffs_base_io_buffer. That copy is useful for *tests*, which compare
that io_buffer's contents to a known good result (i.e. a separate I/O
buffer filled with the contents of a golden file), but it isn't
necessary for *benches*. Dropping that unnecessary copy reduces the
total time per iteration, and therefore increases the reported speed.

name                                        old speed      new speed       delta

wuffs_bmp_decode_40k/clang5                 2.09GB/s ± 2%   2.48GB/s ± 0%  +18.78%  (p=0.008 n=5+5)

wuffs_bmp_decode_40k/gcc7                   1.73GB/s ± 1%   1.93GB/s ± 0%  +11.54%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/clang5                291MB/s ± 0%    376MB/s ± 1%  +29.14%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang5  95.3MB/s ± 1%  103.2MB/s ± 1%   +8.37%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang5   117MB/s ± 0%    130MB/s ± 0%  +10.68%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang5             469MB/s ± 0%    489MB/s ± 1%   +4.39%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang5          126MB/s ± 1%    130MB/s ± 1%   +3.50%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang5                  152MB/s ± 0%    156MB/s ± 1%   +2.77%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang5      318MB/s ± 0%    329MB/s ± 0%   +3.53%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang5       137MB/s ± 0%    139MB/s ± 0%   +1.40%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/clang5      138MB/s ± 0%    140MB/s ± 1%   +1.45%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang5      139MB/s ± 0%    140MB/s ± 1%   +1.03%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang5       661MB/s ± 0%    747MB/s ± 1%  +13.08%  (p=0.008 n=5+5)

mimic_gif_decode_1k_bw/clang5               92.0MB/s ± 0%   91.9MB/s ± 1%     ~     (p=0.841 n=5+5)
mimic_gif_decode_1k_color/clang5            45.5MB/s ± 0%   45.7MB/s ± 0%   +0.45%  (p=0.032 n=5+4)
mimic_gif_decode_10k_indexed/clang5         53.5MB/s ± 0%   53.7MB/s ± 0%   +0.31%  (p=0.032 n=5+4)
mimic_gif_decode_20k/clang5                 55.5MB/s ± 0%   55.1MB/s ± 2%     ~     (p=0.690 n=5+5)
mimic_gif_decode_100k_artificial/clang5     88.8MB/s ± 0%   89.0MB/s ± 1%     ~     (p=0.151 n=5+5)
mimic_gif_decode_100k_realistic/clang5      53.5MB/s ± 1%   53.7MB/s ± 0%   +0.31%  (p=0.024 n=5+5)
mimic_gif_decode_1000k/clang5               54.6MB/s ± 0%   54.6MB/s ± 1%     ~     (p=0.222 n=5+5)
mimic_gif_decode_anim_screencap/clang5       106MB/s ± 0%    109MB/s ± 0%   +2.59%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc7                  284MB/s ± 0%    356MB/s ± 0%  +25.33%  (p=0.016 n=4+5)
wuffs_gif_decode_1k_color_full_init/gcc7    82.1MB/s ± 0%   95.3MB/s ± 0%  +16.08%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc7    97.5MB/s ± 0%  117.4MB/s ± 0%  +20.39%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc7               345MB/s ± 0%    396MB/s ± 0%  +14.71%  (p=0.016 n=4+5)
wuffs_gif_decode_10k_indexed/gcc7            104MB/s ± 0%    121MB/s ± 0%  +16.38%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc7                    131MB/s ± 0%    149MB/s ± 0%  +13.55%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc7        293MB/s ± 0%    321MB/s ± 1%   +9.77%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc7         116MB/s ± 1%    130MB/s ± 1%  +12.10%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc7        117MB/s ± 1%    132MB/s ± 1%  +12.53%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc7        117MB/s ± 0%    132MB/s ± 1%  +12.20%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc7         615MB/s ± 2%    711MB/s ± 2%  +15.53%  (p=0.008 n=5+5)

mimic_gif_decode_1k_bw/gcc7                 91.4MB/s ± 0%   91.7MB/s ± 1%     ~     (p=0.095 n=5+5)
mimic_gif_decode_1k_color/gcc7              46.3MB/s ± 0%   46.2MB/s ± 2%     ~     (p=0.841 n=5+5)
mimic_gif_decode_10k_indexed/gcc7           51.9MB/s ± 1%   51.7MB/s ± 1%     ~     (p=0.310 n=5+5)
mimic_gif_decode_20k/gcc7                   54.2MB/s ± 0%   54.2MB/s ± 1%     ~     (p=0.421 n=5+5)
mimic_gif_decode_100k_artificial/gcc7       88.4MB/s ± 1%   88.7MB/s ± 1%     ~     (p=0.222 n=5+5)
mimic_gif_decode_100k_realistic/gcc7        53.7MB/s ± 0%   53.7MB/s ± 0%     ~     (p=0.206 n=5+5)
mimic_gif_decode_1000k/gcc7                 53.8MB/s ± 2%   54.0MB/s ± 2%     ~     (p=0.690 n=5+5)
mimic_gif_decode_anim_screencap/gcc7         106MB/s ± 0%    109MB/s ± 0%   +2.79%  (p=0.008 n=5+5)
2020-06-01 13:59:50 +10:00