Commit Graph
50 Commits
Author SHA1 Message Date
Nigel Tao aae5997e12 lang: remove endwhile keyword 2024-07-08 17:15:48 +10:00
Patrick Georgi f563f32f82 Add SPDX identifier to license headers
SPDX is an ISO standard for describing licenses in a computer readable
format, which is useful when applying license compliance tools and the
like to source code.

In addition to ensuring that the Wuffs C distribution is properly
annotated to the benefit of projects using Wuffs and SPDX-supporting
tools, add it everywhere else where there's a license in this repo for
consistency, too.
2023-10-06 20:52:36 +02:00
Nigel Tao 74a6ea2fcd all: relicense from Apache2 to dual Apache2/MIT
The LICENSE has changed from a single license (Apache2) to a dual
license (Apache2 or MIT, at your option).

If you've previously used Wuffs under the Apache2 license, you are able
to keep doing so. No further action required by you.

The two files listed below (previous releases) are exceptions, as they
are older snapshots, frozen in time. Their license has not changed:
release/c/wuffs-v0.2.c
release/c/wuffs-v0.3.c

Every name in the AUTHORS file, other than Google Inc., has signed
Google's CLA (Contributor License Agreement).
2023-10-06 10:00:59 +11:00
Nigel Tao 80b1988237 std: add hasher_u32 update!, checksum_u32 methods 2023-10-05 19:27:02 +11:00
Nigel Tao 4dfd70928b std: add "get_quirk(key: u32) u64" 2023-07-16 12:04:09 +10:00
Nigel Tao 6e84987d33 std: change set_quirk_enabled to set_quirk 2023-04-14 21:42:15 +10:00
Nigel Tao 29c4122360 lang: have hasher_u32.update_u32 take a roslice 2023-04-10 21:16:53 +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 e77d73e3ce Add std/adler32 bench comment for the roll back 2021-04-28 22:38:10 +10:00
Nigel Tao 0a6cce5e0e Tweak some adler32 hasher.up_x86_sse42 var names 2021-04-28 00:32:32 +10:00
Nigel Tao abd37fa3f8 Roll back 'Add std/adler32 hasher.up_x86_avx2'
See the previous commit for the rationale.
2021-04-28 00:26:54 +10:00
Nigel Tao baec831fc8 Add std/adler32 hasher.up_x86_avx2
While the std/adler32 benchmarks got better, the std/zlib and std/png
benchmarks got worse.

This commit will soon be followed by a rollback, but it is committed
anyway so that we can refer to these numbers in the git log.

Binary size, before:
4056 gen/lib/c/clang-9-dynamic/wuffs-std-adler32.lo
4104 gen/lib/c/clang-9-static/wuffs-std-adler32.o
4624 gen/lib/c/gcc-dynamic/wuffs-std-adler32.lo
4680 gen/lib/c/gcc-static/wuffs-std-adler32.o

After:
4952 gen/lib/c/clang-9-dynamic/wuffs-std-adler32.lo
5016 gen/lib/c/clang-9-static/wuffs-std-adler32.o
5512 gen/lib/c/gcc-dynamic/wuffs-std-adler32.lo
5576 gen/lib/c/gcc-static/wuffs-std-adler32.o

name                                                      old speed      new speed      delta

wuffs_adler32_10k/clang9                                  11.5GB/s ± 1%  15.0GB/s ± 5%  +30.73%  (p=0.000 n=9+10)
wuffs_adler32_100k/clang9                                 13.5GB/s ± 1%  15.6GB/s ±14%  +16.06%  (p=0.001 n=9+10)

wuffs_adler32_10k/gcc10                                   11.3GB/s ± 2%  15.6GB/s ± 1%  +38.27%  (p=0.000 n=9+9)
wuffs_adler32_100k/gcc10                                  11.3GB/s ± 1%  19.4GB/s ± 1%  +71.20%  (p=0.000 n=7+9)

wuffs_zlib_decode_10k/clang9                               223MB/s ± 1%   216MB/s ± 2%   -3.45%  (p=0.000 n=10+10)
wuffs_zlib_decode_100k/clang9                              285MB/s ± 1%   284MB/s ± 1%     ~     (p=0.243 n=9+10)

wuffs_zlib_decode_10k/gcc10                                232MB/s ± 1%   216MB/s ± 1%   -6.70%  (p=0.000 n=10+9)
wuffs_zlib_decode_100k/gcc10                               291MB/s ± 1%   280MB/s ± 1%   -3.70%  (p=0.000 n=9+8)

wuffs_png_decode_image_19k_8bpp/clang9                     152MB/s ± 1%   143MB/s ± 3%   -5.89%  (p=0.000 n=8+9)
wuffs_png_decode_image_40k_24bpp/clang9                    171MB/s ± 1%   173MB/s ± 1%     ~     (p=0.094 n=9+9)
wuffs_png_decode_image_77k_8bpp/clang9                     541MB/s ± 1%   509MB/s ± 1%   -5.77%  (p=0.000 n=8+9)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   479MB/s ± 1%   464MB/s ± 3%   -3.20%  (p=0.000 n=8+10)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   461MB/s ± 1%   452MB/s ± 1%   -2.02%  (p=0.000 n=8+10)
wuffs_png_decode_image_4002k_24bpp/clang9                  177MB/s ± 1%   175MB/s ± 2%   -1.14%  (p=0.004 n=10+10)

wuffs_png_decode_image_19k_8bpp/gcc10                      159MB/s ± 1%   153MB/s ± 1%   -3.54%  (p=0.000 n=8+10)
wuffs_png_decode_image_40k_24bpp/gcc10                     188MB/s ± 1%   187MB/s ± 1%   -0.47%  (p=0.021 n=10+9)
wuffs_png_decode_image_77k_8bpp/gcc10                      557MB/s ± 0%   546MB/s ± 4%   -1.94%  (p=0.000 n=8+10)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    510MB/s ± 0%   493MB/s ± 0%   -3.33%  (p=0.000 n=10+9)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    486MB/s ± 1%   478MB/s ± 0%   -1.77%  (p=0.000 n=8+9)
wuffs_png_decode_image_4002k_24bpp/gcc10                   189MB/s ± 1%   187MB/s ± 1%   -1.26%  (p=0.000 n=10+10)
2021-04-28 00:18:20 +10:00
Nigel Tao 3b5d8fdfba Use arm_neon_uAxB types and methods 2021-02-24 16:48:09 +11:00
Nigel Tao fa774e647f Add x86_sse42_utility.make_m128i_slice128 2021-02-18 22:32:21 +11:00
Nigel Tao 8c8f534a5c Add base.x86_sse42_utility 2021-02-18 20:02:58 +11:00
Nigel Tao 8c4348b8f6 Rename some std etc_sse42 functions 2021-02-18 13:48:46 +11:00
Nigel Tao 4c3f8ccfff Factor out std/adler32/common_up_x86_sse42.wuffs 2021-02-16 22:23:54 +11:00
Nigel Tao 010b34ed38 Add std/adler32 hasher.up_arm_neon
On a Raspberry Pi 4 (32-bit armv7l) with -march=native and -mfpu=neon
("native" means "armv8-a+crc+simd"):

wuffs_adler32_10k/clang9                                  1.21GB/s ± 0%   6.58GB/s ± 1%  +442.43%  (p=0.008 n=5+5)
wuffs_adler32_100k/clang9                                 1.20GB/s ± 0%   6.58GB/s ± 0%  +449.37%  (p=0.008 n=5+5)

wuffs_adler32_10k/gcc8                                    1.24GB/s ± 0%   4.31GB/s ± 0%  +248.87%  (p=0.008 n=5+5)
wuffs_adler32_100k/gcc8                                   1.22GB/s ± 0%   4.29GB/s ± 0%  +251.09%  (p=0.008 n=5+5)

mimic_adler32_10k                                         1.40GB/s ± 0%   1.40GB/s ± 0%    -0.04%  (p=0.008 n=5+5)
mimic_adler32_100k                                        1.35GB/s ± 0%   1.38GB/s ± 0%    +2.77%  (p=0.008 n=5+5)

wuffs_zlib_decode_10k/clang9                              85.3MB/s ± 0%   91.1MB/s ± 0%    +6.83%  (p=0.008 n=5+5)
wuffs_zlib_decode_100k/clang9                              107MB/s ± 0%    113MB/s ± 0%    +5.20%  (p=0.008 n=5+5)

wuffs_zlib_decode_10k/gcc8                                86.1MB/s ± 0%   91.0MB/s ± 0%    +5.69%  (p=0.008 n=5+5)
wuffs_zlib_decode_100k/gcc8                                104MB/s ± 0%    111MB/s ± 0%    +7.08%  (p=0.016 n=5+4)

mimic_zlib_decode_10k                                      108MB/s ± 0%    108MB/s ± 0%      ~     (p=0.548 n=5+5)
mimic_zlib_decode_100k                                     142MB/s ± 0%    141MB/s ± 1%      ~     (p=0.310 n=5+5)

wuffs_png_decode_image_19k_8bpp/clang9                    69.9MB/s ± 0%   74.3MB/s ± 0%    +6.37%  (p=0.016 n=5+4)
wuffs_png_decode_image_40k_24bpp/clang9                   99.4MB/s ± 0%  104.3MB/s ± 0%    +4.92%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9                     266MB/s ± 0%    280MB/s ± 0%    +5.21%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   165MB/s ± 0%    169MB/s ± 0%    +2.45%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   146MB/s ± 0%    163MB/s ± 0%   +11.86%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang9                 93.2MB/s ± 0%   97.7MB/s ± 0%    +4.78%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc8                      70.3MB/s ± 0%   74.3MB/s ± 0%    +5.70%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc8                      101MB/s ± 0%    107MB/s ± 0%    +5.67%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc8                       247MB/s ± 0%    259MB/s ± 0%    +4.71%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc8     162MB/s ± 0%    162MB/s ± 0%    +0.09%  (p=0.032 n=5+4)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc8     140MB/s ± 0%    155MB/s ± 0%   +10.67%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc8                   94.1MB/s ± 0%   99.4MB/s ± 0%    +5.57%  (p=0.008 n=5+5)

mimic_png_decode_image_19k_8bpp                           43.6MB/s ± 0%   43.3MB/s ± 1%      ~     (p=0.167 n=5+5)
mimic_png_decode_image_40k_24bpp                          54.6MB/s ± 0%   54.6MB/s ± 0%      ~     (p=1.000 n=5+5)
mimic_png_decode_image_77k_8bpp                            125MB/s ± 0%    123MB/s ± 0%    -1.03%  (p=0.016 n=5+4)
mimic_png_decode_image_552k_32bpp_ignore_checksum               skipped
mimic_png_decode_image_552k_32bpp_verify_checksum          102MB/s ± 0%    101MB/s ± 0%    -0.43%  (p=0.008 n=5+5)
mimic_png_decode_image_4002k_24bpp                        81.3MB/s ± 0%   81.8MB/s ± 0%    +0.62%  (p=0.008 n=5+5)
2021-02-16 22:17:46 +11:00
Nigel Tao 8c4c714ad1 Add 0b prefixed binary numbers 2021-01-28 21:54:06 +11:00
Nigel Tao b61a827354 Optimize std/adler32 for SSE4.2
On a mid-range x86_64 laptop:

wuffs_adler32_10k/clang9                                  1.35GB/s ± 0%  10.78GB/s ± 1%  +700.65%  (p=0.008 n=5+5)
wuffs_adler32_100k/clang9                                 1.35GB/s ± 0%  12.88GB/s ± 0%  +856.09%  (p=0.008 n=5+5)

wuffs_adler32_10k/gcc10                                   1.85GB/s ± 0%  11.21GB/s ± 0%  +506.34%  (p=0.008 n=5+5)
wuffs_adler32_100k/gcc10                                  1.84GB/s ± 0%  11.43GB/s ± 0%  +521.51%  (p=0.008 n=5+5)

mimic_adler32_10k                                         1.76GB/s ± 0%   1.76GB/s ± 0%      ~     (p=0.841 n=5+5)
mimic_adler32_100k                                        1.72GB/s ± 0%   1.72GB/s ± 0%      ~     (p=0.222 n=5+5)

wuffs_zlib_decode_10k/clang9                               124MB/s ± 0%    139MB/s ± 0%   +12.29%  (p=0.016 n=4+5)
wuffs_zlib_decode_100k/clang9                              148MB/s ± 0%    155MB/s ± 0%    +4.21%  (p=0.008 n=5+5)

wuffs_zlib_decode_10k/gcc10                                133MB/s ± 1%    141MB/s ± 0%    +5.75%  (p=0.008 n=5+5)
wuffs_zlib_decode_100k/gcc10                               159MB/s ± 0%    172MB/s ± 0%    +7.77%  (p=0.016 n=5+4)

mimic_zlib_decode_10k                                      133MB/s ± 0%    133MB/s ± 0%    +0.38%  (p=0.008 n=5+5)
mimic_zlib_decode_100k                                     160MB/s ± 0%    160MB/s ± 0%      ~     (p=0.841 n=5+5)

wuffs_png_decode_image_19k_8bpp/clang9                    90.6MB/s ± 0%   94.7MB/s ± 0%    +4.58%  (p=0.016 n=5+4)
wuffs_png_decode_image_40k_24bpp/clang9                    129MB/s ± 0%    135MB/s ± 0%    +4.49%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9                     335MB/s ± 0%    351MB/s ± 0%    +4.62%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   322MB/s ± 0%    320MB/s ± 1%    -0.71%  (p=0.016 n=4+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   256MB/s ± 0%    308MB/s ± 0%   +20.24%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang9                  131MB/s ± 0%    138MB/s ± 0%    +5.24%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                     95.1MB/s ± 0%  100.8MB/s ± 1%    +6.08%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                     131MB/s ± 0%    136MB/s ± 0%    +3.65%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10                      350MB/s ± 1%    371MB/s ± 0%    +6.06%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    327MB/s ± 0%    333MB/s ± 0%    +1.66%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    274MB/s ± 0%    318MB/s ± 0%   +15.93%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                   132MB/s ± 0%    138MB/s ± 0%    +4.73%  (p=0.008 n=5+5)

mimic_png_decode_image_19k_8bpp                           58.1MB/s ± 0%   58.2MB/s ± 0%    +0.27%  (p=0.008 n=5+5)
mimic_png_decode_image_40k_24bpp                          73.0MB/s ± 1%   73.3MB/s ± 0%    +0.45%  (p=0.008 n=5+5)
mimic_png_decode_image_77k_8bpp                            177MB/s ± 0%    177MB/s ± 0%      ~     (p=0.421 n=5+5)
mimic_png_decode_image_552k_32bpp_ignore_checksum               skipped
mimic_png_decode_image_552k_32bpp_verify_checksum          146MB/s ± 0%    146MB/s ± 0%      ~     (p=0.310 n=5+5)
mimic_png_decode_image_4002k_24bpp                         104MB/s ± 0%    104MB/s ± 0%      ~     (p=0.056 n=5+5)
2021-01-26 22:31:54 +11:00
Nigel Tao a1a70da539 Add iterate advance parameter 2021-01-11 00:03:44 +11:00
Nigel Tao 4bc42db1d3 Add set_quirk_enabled interface methods 2020-04-12 20:53:54 +10:00
Nigel Tao 58351d44da Make endwhile mandatory for nameless loops 2020-03-25 21:40:00 +11:00
Nigel Tao ea54c2ea11 Add syntax support for implementing interfaces 2020-01-09 15:45:29 +11:00
Nigel Tao 8c8d9d8b52 Fix "noticable" typo 2019-12-07 11:51:54 +11:00
Nigel Tao 8ff9cdb9a6 Rename hasher update_u32 method 2019-11-20 21:07:22 +11:00
Nigel Tao a21ad25bb8 Rename x T to x: T for vars 2019-10-12 21:55:13 +11:00
Nigel Tao 1520a1f345 Rename x T to x: T for fields and func args 2019-10-12 21:49:04 +11:00
Nigel Tao 5b4e3647c0 Reformat x:y as x: y 2019-10-12 21:21:39 +11:00
Nigel Tao a9ea63ff06 Rename [i:j] to [i .. j], the same as Rust 2019-10-12 21:14:18 +11:00
Nigel Tao a7e2fc86d2 Add commentary about the Adler-32 algorithm 2019-03-09 11:20:30 +11:00
Nigel Tao d26fa09d07 Have wuffsfmt align the "T"s in "x T" fields 2018-12-27 15:09:52 +11:00
Nigel Tao 1ceb304ad9 Have wuffsfmt align the "T"s in "var x T" blocks 2018-12-27 14:19:20 +11:00
Nigel Tao 84f9d3a915 Prohibit "this.etc = etc" inside pure functions 2018-12-27 11:01:55 +11:00
Nigel Tao d552f88738 Make Iterate contain Assign's not Var's 2018-12-27 10:35:27 +11:00
Nigel Tao 25776a724e Place more vars at the top of functions 2018-12-26 19:14:07 +11:00
Nigel Tao 6236e7205f Remove packageid 2018-08-12 21:44:49 +10:00
Nigel Tao ca06083f8a Rename the implicit in variable to args 2018-07-29 10:26:22 +10:00
Nigel Tao 9919d78245 Change func out-type from struct to bare type 2018-07-29 10:02:06 +10:00
Nigel Tao 0e498cb86d Remove use of struct field initial values 2018-05-29 09:07:23 +10:00
Nigel Tao dfc8e14f4f Fix some hasher methods' effects 2018-05-12 18:01:24 +10:00
Nigel Tao 282b9c4b20 Place iterate params after vars, not before 2018-05-10 09:38:14 +10:00
Nigel Tao 79aded4797 Introduce a =: operator 2018-05-10 09:31:58 +10:00
Nigel Tao 1702c1e303 Rename iterate's step to length 2018-05-05 08:25:23 +10:00
Nigel Tao 96a549814d Change iterate variable types from ptr to slice 2018-05-04 13:20:34 +10:00
Nigel Tao 6f6d4a2530 Use p[0] instead of deref p inside an iterate 2018-05-04 12:26:34 +10:00
Nigel Tao c511c53b1f Clarify iterate step and unroll syntax 2018-05-04 09:14:10 +10:00
Nigel Tao a73e56712d Add an iterate step argument 2018-05-03 22:34:24 +10:00
Nigel Tao 035b138cb1 Spin out a std/adler32 package 2018-04-27 17:20:10 +10:00