Commit Graph
74 Commits
Author SHA1 Message Date
Nigel Tao 40f39a3ba3 cgen: omit "x ~mod+= y ~mod* 0" 2026-06-19 20:28:56 +10:00
Nigel Tao cc9ee184d0 cgen: omit consecutive Wconversion gcc pragmas 2024-07-09 12:39:16 +10:00
Nigel Tao affa1e02d4 base: add WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V2
Updates #148
2024-07-09 09:17:09 +10:00
Nigel Tao 37a3c3ce9b base: rename WUFFS_BASE__CPU_ARCH__ETC
See
https://github.com/google/wuffs/issues/148#issuecomment-2130535812

Updates #148
2024-07-08 18:14:59 +10:00
Nigel Tao 4209264a85 cgen: disable SIMD on 32-bit (not 64-bit) x86
Updates #145
2024-04-06 15:27:44 +11:00
Nigel Tao 2142aa65fc cgen: fix iterate's "ptr + len" when ptr is NULL
Updates #135
2024-04-05 13:47:25 +11:00
Nigel Tao e5dc87e4d3 cgen: have writeStatementIOManip use switches 2024-02-09 15:21:37 +11:00
Nigel Tao be1b1b564c cgen: reformat "uint8_t *o_etc" 2024-02-09 15:09:50 +11:00
Nigel Tao d2ecc20141 std/xz: use io_forget_history 2024-02-09 15:06:11 +11:00
Nigel Tao e8af2d0635 lang: refactor anticipating io_forget_history 2024-02-09 14:55:35 +11:00
Nigel Tao 0164364106 ast: add TypeExpr.IsSmallInteger method 2023-12-14 10:22:38 +11:00
Nigel Tao c4d2fa13da cgen: apply disableWconversion even more often 2023-12-14 10:20:16 +11:00
Nigel Tao 9520d6de36 cgen: apply disableWconversion more often
Fixes #138
2023-12-14 10:07:50 +11:00
Nigel Tao 9a68ec70c6 base: use wuffs_private_impl__etc names 2023-11-02 22:30:10 +11: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 e2b9566fc5 base: restrict x86_avx2 to 64-bit (not 32-bit) x86
32-bit C/C++ compilers don't always compile the AVX intrinsics. Per the
60773 bug below,
> clang++ -m32 etc etc fuzz/c/std/jpeg_fuzzer.c
> undefined reference to `_mm_cvtsi128_si64'
> undefined reference to `_mm256_extract_epi64'

See also the "#ifdef __x86_64__" guards in
https://github.com/gcc-mirror/gcc/blob/4a3895903c29ed85da6fcb886f31ff23d4c6e935/gcc/config/i386/emmintrin.h#L228-L231
https://github.com/llvm/llvm-project/blob/08fab9ebecf72a682279d75489dc2460121cbeed/clang/lib/Headers/emmintrin.h#L3502-L3515

Note that -m32 is not the same as -mx32
> $ touch empty.c
> $ gcc       -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __x86_64__ 1
> $ gcc -m32  -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __i386__ 1
> $ gcc -mx32 -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __x86_64__ 1

Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60773
2023-07-23 21:20:35 +10:00
Nigel Tao b97560b292 cgen: emit "do { etc } while (0);" for some loops 2023-06-28 22:58:07 +10:00
Nigel Tao 66ef485efa cgen: emit "break/continue" not "goto", part 3
A selection of benchmarks below. Some are up, some are down.

name                                                                old speed      new speed      delta

wuffs_bzip2_decode_10k/clang11                                      59.5MB/s ± 0%  59.1MB/s ± 0%   -0.72%  (p=0.008 n=5+5)
wuffs_bzip2_decode_100k/clang11                                     49.6MB/s ± 1%  47.4MB/s ± 0%   -4.48%  (p=0.008 n=5+5)

wuffs_bzip2_decode_10k/gcc10                                        59.0MB/s ± 0%  59.8MB/s ± 0%   +1.40%  (p=0.008 n=5+5)
wuffs_bzip2_decode_100k/gcc10                                       49.8MB/s ± 2%  53.0MB/s ± 0%   +6.51%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k_full_init/clang11                            184MB/s ± 0%   182MB/s ± 0%   -1.06%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/clang11                            213MB/s ± 0%   211MB/s ± 0%   -0.65%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/clang11                           399MB/s ± 0%   409MB/s ± 0%   +2.68%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/clang11                           409MB/s ± 0%   421MB/s ± 0%   +2.96%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/clang11                      518MB/s ± 0%   517MB/s ± 0%     ~     (p=0.095 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/clang11                     322MB/s ± 0%   319MB/s ± 0%   -0.93%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k_full_init/gcc10                              173MB/s ± 0%   175MB/s ± 0%   +1.07%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/gcc10                              205MB/s ± 0%   208MB/s ± 0%   +1.26%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/gcc10                             408MB/s ± 0%   396MB/s ± 0%   -2.94%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/gcc10                             421MB/s ± 0%   408MB/s ± 0%   -2.88%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/gcc10                        542MB/s ± 0%   519MB/s ± 0%   -4.13%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/gcc10                       340MB/s ± 0%   327MB/s ± 0%   -3.77%  (p=0.008 n=5+5)

wuffs_json_decode_1k/clang11                                        1.26GB/s ± 0%  1.34GB/s ± 0%   +6.90%  (p=0.008 n=5+5)
wuffs_json_decode_21k_formatted/clang11                              681MB/s ± 0%   684MB/s ± 0%   +0.47%  (p=0.008 n=5+5)
wuffs_json_decode_26k_compact/clang11                               1.00GB/s ± 0%  1.14GB/s ± 0%  +14.26%  (p=0.008 n=5+5)
wuffs_json_decode_217k_stringy/clang11                               786MB/s ± 0%   907MB/s ± 0%  +15.40%  (p=0.008 n=5+5)

wuffs_json_decode_1k/gcc10                                          1.20GB/s ± 0%  1.22GB/s ± 0%   +1.41%  (p=0.008 n=5+5)
wuffs_json_decode_21k_formatted/gcc10                                681MB/s ± 0%   719MB/s ± 0%   +5.59%  (p=0.008 n=5+5)
wuffs_json_decode_26k_compact/gcc10                                  957MB/s ± 0%   976MB/s ± 0%   +1.94%  (p=0.008 n=5+5)
wuffs_json_decode_217k_stringy/gcc10                                 773MB/s ± 0%   781MB/s ± 0%   +1.01%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/clang11                              256MB/s ± 0%   256MB/s ± 0%     ~     (p=0.421 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang11                             311MB/s ± 0%   313MB/s ± 0%   +0.57%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang11                              907MB/s ± 0%   904MB/s ± 0%   -0.28%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang11            821MB/s ± 0%   812MB/s ± 0%   -1.08%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang11            790MB/s ± 0%   782MB/s ± 0%   -0.94%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang11                           315MB/s ± 0%   315MB/s ± 0%   -0.09%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                                266MB/s ± 0%   273MB/s ± 0%   +2.94%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                               329MB/s ± 0%   324MB/s ± 2%   -1.65%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10                                952MB/s ± 2%   967MB/s ± 0%   +1.57%  (p=0.016 n=5+4)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10              871MB/s ± 0%   894MB/s ± 0%   +2.59%  (p=0.029 n=4+4)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10              831MB/s ± 0%   851MB/s ± 0%   +2.45%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                             336MB/s ± 0%   335MB/s ± 0%   -0.53%  (p=0.008 n=5+5)
2023-06-23 21:04:24 +10:00
Nigel Tao de55ff7746 cgen: emit "break/continue" not "goto", part 2
name                                             old speed     new speed     delta

wuffs_jpeg_decode_19k_8bpp/clang11               241MB/s ± 0%  241MB/s ± 0%    ~     (p=0.690 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11  213MB/s ± 0%  213MB/s ± 0%    ~     (p=0.690 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11   386MB/s ± 0%  387MB/s ± 0%    ~     (p=0.270 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11              341MB/s ± 0%  341MB/s ± 0%    ~     (p=0.556 n=5+4)
wuffs_jpeg_decode_552k_24bpp_420/clang11         356MB/s ± 0%  356MB/s ± 0%    ~     (p=0.310 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11         484MB/s ± 0%  484MB/s ± 0%    ~     (p=0.095 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11            362MB/s ± 0%  364MB/s ± 0%    ~     (p=0.095 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                 245MB/s ± 0%  244MB/s ± 0%  -0.19%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    252MB/s ± 0%  254MB/s ± 0%  +0.76%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10     513MB/s ± 0%  508MB/s ± 0%  -0.88%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                433MB/s ± 0%  434MB/s ± 0%  +0.38%  (p=0.016 n=4+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10           458MB/s ± 0%  456MB/s ± 0%  -0.41%  (p=0.029 n=4+4)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           486MB/s ± 0%  481MB/s ± 0%  -1.00%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10              465MB/s ± 0%  463MB/s ± 0%  -0.39%  (p=0.029 n=4+4)
2023-06-23 18:29:20 +10:00
Nigel Tao f155db4d5c cgen: emit "break/continue" not "goto", part 1
name                                             old speed     new speed     delta

wuffs_jpeg_decode_19k_8bpp/clang11               229MB/s ± 0%  241MB/s ± 0%  +5.29%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11  205MB/s ± 0%  213MB/s ± 0%  +3.89%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11   375MB/s ± 0%  386MB/s ± 0%  +3.01%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11              326MB/s ± 0%  341MB/s ± 0%  +4.80%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang11         339MB/s ± 0%  356MB/s ± 0%  +5.14%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11         475MB/s ± 0%  484MB/s ± 0%  +2.04%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11            343MB/s ± 0%  362MB/s ± 0%  +5.77%  (p=0.008 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                 245MB/s ± 0%  245MB/s ± 0%  -0.07%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    254MB/s ± 0%  252MB/s ± 0%  -0.52%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10     514MB/s ± 0%  513MB/s ± 0%    ~     (p=0.151 n=5+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                434MB/s ± 0%  433MB/s ± 0%  -0.35%  (p=0.016 n=5+4)
wuffs_jpeg_decode_552k_24bpp_420/gcc10           459MB/s ± 0%  458MB/s ± 0%  -0.12%  (p=0.016 n=5+4)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           486MB/s ± 0%  486MB/s ± 0%  -0.03%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10              467MB/s ± 0%  465MB/s ± 0%  -0.26%  (p=0.016 n=5+4)
2023-06-23 17:46:40 +10:00
Nigel Tao 8916f1b6ea lang: add if.likely and if.unlikely 2023-06-20 18:00:48 +10:00
Nigel Tao f3caf09d77 lang: add read-only type decorators 2023-04-10 15:29:12 +10:00
Nigel Tao d7c48ae76b cgen: have io_limit update meta.closed 2023-01-31 22:05:20 +11:00
Nigel Tao cb2e49ab09 Rename CPU arch macro s/X86_64/X86_FAMILY/ 2021-08-22 22:23:49 +10:00
Nigel Tao f73f95b698 Rename from ast.IOBind to ast.IOManip 2021-08-15 08:40:05 +10:00
Nigel Tao 28a54baa19 Add io_bind history_position arg 2021-08-15 08:36:14 +10:00
Nigel Tao f6945c0612 Remove unnecessary "goto ok;" in generated C code 2021-06-25 14:47:10 +10:00
Nigel Tao 2dddd388bc Add crc32.ieee_hasher.up_x86_avx2
name                                                      old speed      new speed      delta

wuffs_crc32_ieee_10k/clang9                               8.42GB/s ± 1%  8.12GB/s ± 1%   -3.55%  (p=0.000 n=9+8)
wuffs_crc32_ieee_100k/clang9                              11.0GB/s ± 1%  10.9GB/s ± 1%     ~     (p=0.931 n=9+9)

wuffs_crc32_ieee_10k/gcc10                                9.20GB/s ± 0%  9.71GB/s ± 0%   +5.54%  (p=0.000 n=8+10)
wuffs_crc32_ieee_100k/gcc10                               11.9GB/s ± 2%  13.1GB/s ± 1%  +10.22%  (p=0.000 n=10+8)

wuffs_gzip_decode_10k/clang9                               219MB/s ± 1%   218MB/s ± 2%     ~     (p=0.497 n=9+10)
wuffs_gzip_decode_100k/clang9                              283MB/s ± 2%   281MB/s ± 1%     ~     (p=0.063 n=10+10)

wuffs_gzip_decode_10k/gcc10                                224MB/s ± 1%   223MB/s ± 1%     ~     (p=0.489 n=9+9)
wuffs_gzip_decode_100k/gcc10                               285MB/s ± 4%   290MB/s ± 0%   +1.68%  (p=0.004 n=10+8)

wuffs_png_decode_image_19k_8bpp/clang9                     138MB/s ± 2%   138MB/s ± 1%     ~     (p=0.156 n=10+9)
wuffs_png_decode_image_40k_24bpp/clang9                    171MB/s ± 2%   172MB/s ± 1%     ~     (p=0.971 n=10+10)
wuffs_png_decode_image_77k_8bpp/clang9                     495MB/s ± 4%   504MB/s ± 1%   +1.79%  (p=0.000 n=9+9)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   457MB/s ± 4%   463MB/s ± 0%   +1.35%  (p=0.002 n=9+9)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   435MB/s ± 5%   445MB/s ± 1%   +2.31%  (p=0.000 n=10+9)
wuffs_png_decode_image_4002k_24bpp/clang9                  172MB/s ± 2%   174MB/s ± 1%     ~     (p=0.053 n=10+9)

wuffs_png_decode_image_19k_8bpp/gcc10                      157MB/s ± 1%   157MB/s ± 1%     ~     (p=0.549 n=9+10)
wuffs_png_decode_image_40k_24bpp/gcc10                     187MB/s ± 1%   186MB/s ± 1%     ~     (p=0.182 n=10+9)
wuffs_png_decode_image_77k_8bpp/gcc10                      554MB/s ± 1%   559MB/s ± 0%   +0.84%  (p=0.000 n=9+9)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    502MB/s ± 1%   500MB/s ± 0%   -0.38%  (p=0.011 n=10+10)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    481MB/s ± 1%   478MB/s ± 0%   -0.46%  (p=0.002 n=8+9)
wuffs_png_decode_image_4002k_24bpp/gcc10                   189MB/s ± 2%   190MB/s ± 0%   +0.62%  (p=0.008 n=10+9)
2021-04-09 23:12:32 +10:00
Nigel Tao a7ef82f7db Add deflate.decoder.decode_huffman_bmi2
Binary size, before:
21864 gen/lib/c/clang-9-dynamic/wuffs-std-deflate.lo
21488 gen/lib/c/clang-9-static/wuffs-std-deflate.o
21136 gen/lib/c/gcc-dynamic/wuffs-std-deflate.lo
21536 gen/lib/c/gcc-static/wuffs-std-deflate.o

After:
24592 gen/lib/c/clang-9-dynamic/wuffs-std-deflate.lo
24368 gen/lib/c/clang-9-static/wuffs-std-deflate.o
23320 gen/lib/c/gcc-dynamic/wuffs-std-deflate.lo
23928 gen/lib/c/gcc-static/wuffs-std-deflate.o

I've upgraded my kernel and compilers recently, so the absolute Wuffs
benchmark numbers below aren't directly comparable to those reported in
previous commits, but the relative changes still seems valid.

On a mid-range x86_64 laptop:

name                                                      old speed      new speed      delta

wuffs_deflate_decode_1k_full_init/clang9                   107MB/s ± 1%   104MB/s ± 1%   -2.36%  (p=0.000 n=8+9)
wuffs_deflate_decode_1k_part_init/clang9                   123MB/s ± 1%   121MB/s ± 1%   -1.78%  (p=0.000 n=10+9)
wuffs_deflate_decode_10k_full_init/clang9                  221MB/s ± 2%   223MB/s ± 1%   +0.86%  (p=0.035 n=10+9)
wuffs_deflate_decode_10k_part_init/clang9                  228MB/s ± 0%   230MB/s ± 1%   +0.59%  (p=0.003 n=8+10)
wuffs_deflate_decode_100k_just_one_read/clang9             276MB/s ± 0%   279MB/s ± 1%   +1.12%  (p=0.001 n=8+9)
wuffs_deflate_decode_100k_many_big_reads/clang9            174MB/s ± 1%   178MB/s ± 5%   +2.38%  (p=0.028 n=9+10)

wuffs_deflate_decode_1k_full_init/gcc10                    103MB/s ± 3%   103MB/s ± 1%     ~     (p=0.105 n=10+10)
wuffs_deflate_decode_1k_part_init/gcc10                    123MB/s ± 1%   122MB/s ± 1%   -0.94%  (p=0.001 n=9+10)
wuffs_deflate_decode_10k_full_init/gcc10                   216MB/s ± 2%   235MB/s ± 1%   +8.83%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_part_init/gcc10                   223MB/s ± 1%   242MB/s ± 1%   +8.45%  (p=0.000 n=9+9)
wuffs_deflate_decode_100k_just_one_read/gcc10              270MB/s ± 4%   300MB/s ± 4%  +11.08%  (p=0.000 n=9+10)
wuffs_deflate_decode_100k_many_big_reads/gcc10             179MB/s ± 1%   193MB/s ± 2%   +7.97%  (p=0.000 n=10+10)

wuffs_gzip_decode_10k/clang9                               218MB/s ± 3%   220MB/s ± 1%     ~     (p=0.549 n=10+9)
wuffs_gzip_decode_100k/clang9                              270MB/s ± 0%   269MB/s ± 2%     ~     (p=0.730 n=9+9)

wuffs_gzip_decode_10k/gcc10                                208MB/s ± 1%   227MB/s ± 1%   +8.87%  (p=0.000 n=9+10)
wuffs_gzip_decode_100k/gcc10                               267MB/s ± 1%   283MB/s ± 1%   +6.05%  (p=0.000 n=10+9)

wuffs_zlib_decode_10k/clang9                               214MB/s ± 2%   226MB/s ± 1%   +5.69%  (p=0.000 n=10+9)
wuffs_zlib_decode_100k/clang9                              259MB/s ± 6%   272MB/s ± 2%   +5.05%  (p=0.000 n=9+10)

wuffs_zlib_decode_10k/gcc10                                211MB/s ± 1%   227MB/s ± 1%   +7.53%  (p=0.000 n=10+10)
wuffs_zlib_decode_100k/gcc10                               262MB/s ± 1%   282MB/s ± 1%   +7.69%  (p=0.000 n=10+9)

wuffs_png_decode_image_19k_8bpp/clang9                     144MB/s ± 0%   148MB/s ± 1%   +2.68%  (p=0.000 n=9+9)
wuffs_png_decode_image_40k_24bpp/clang9                    166MB/s ± 1%   170MB/s ± 1%   +2.38%  (p=0.000 n=9+9)
wuffs_png_decode_image_77k_8bpp/clang9                     515MB/s ± 1%   525MB/s ± 1%   +1.91%  (p=0.000 n=9+8)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   401MB/s ± 1%   400MB/s ± 2%     ~     (p=0.913 n=9+9)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   387MB/s ± 1%   388MB/s ± 1%     ~     (p=0.546 n=9+9)
wuffs_png_decode_image_4002k_24bpp/clang9                  170MB/s ± 3%   175MB/s ± 1%   +3.02%  (p=0.000 n=9+10)

wuffs_png_decode_image_19k_8bpp/gcc10                      143MB/s ± 2%   154MB/s ± 3%   +8.32%  (p=0.000 n=9+9)
wuffs_png_decode_image_40k_24bpp/gcc10                     174MB/s ± 2%   182MB/s ± 1%   +4.42%  (p=0.000 n=10+9)
wuffs_png_decode_image_77k_8bpp/gcc10                      513MB/s ± 2%   552MB/s ± 3%   +7.66%  (p=0.000 n=10+9)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    408MB/s ± 1%   426MB/s ± 2%   +4.43%  (p=0.000 n=9+10)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    390MB/s ± 4%   410MB/s ± 2%   +5.05%  (p=0.000 n=10+9)
wuffs_png_decode_image_4002k_24bpp/gcc10                   177MB/s ± 1%   186MB/s ± 1%   +5.13%  (p=0.000 n=9+9)
2021-04-09 00:06:33 +10:00
Nigel Tao decb64e5ea Add ast.ExprOperatorEtc constants 2021-03-29 19:54:51 +11:00
Nigel Tao 9914f7314d Add WUFFS_BASE__MAYBE_ATTRIBUTE_TARGET 2021-03-17 12:03:06 +11:00
Nigel Tao 5d4fbc3ac6 Implement std/crc32 ieee_hasher.up_x86_sse42
On a mid-range x86_64 laptop:

----

$ ls -lh linux-5.11.3.tar.gz | awk '{print $5 " " $9}'
178M linux-5.11.3.tar.gz

$ # Debian's /usr/bin/crc32
$ time /usr/bin/crc32 /dev/stdin < linux-5.11.3.tar.gz > /dev/null
real    0m0.411s

$ # Wuffs; before
$ time gen/bin/example-crc32     < linux-5.11.3.tar.gz > /dev/null
real    0m0.137s

$ # Wuffs; after
$ time gen/bin/example-crc32     < linux-5.11.3.tar.gz > /dev/null
real    0m0.060s

----

Wuffs benchmarks:

wuffs_crc32_ieee_10k/clang9                               1.71GB/s ± 0%   8.40GB/s ± 3%  +391.97%  (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/clang9                              1.73GB/s ± 1%  10.67GB/s ± 0%  +518.47%  (p=0.008 n=5+5)

wuffs_crc32_ieee_10k/gcc10                                2.08GB/s ± 0%   8.77GB/s ± 0%  +322.05%  (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/gcc10                               2.10GB/s ± 0%  11.23GB/s ± 0%  +435.56%  (p=0.008 n=5+5)

mimic_crc32_ieee_10k                                       774MB/s ± 0%    776MB/s ± 0%    +0.23%  (p=0.016 n=5+5)
mimic_crc32_ieee_100k                                      773MB/s ± 0%    775MB/s ± 0%    +0.24%  (p=0.032 n=5+5)

wuffs_gzip_decode_10k/clang9                               151MB/s ± 0%    166MB/s ± 0%    +9.81%  (p=0.008 n=5+5)
wuffs_gzip_decode_100k/clang9                              155MB/s ± 0%    178MB/s ± 0%   +14.53%  (p=0.008 n=5+5)

wuffs_gzip_decode_10k/gcc10                                150MB/s ± 0%    172MB/s ± 0%   +14.92%  (p=0.008 n=5+5)
wuffs_gzip_decode_100k/gcc10                               188MB/s ± 0%    198MB/s ± 0%    +5.37%  (p=0.008 n=5+5)

mimic_gzip_decode_10k                                      121MB/s ± 0%    121MB/s ± 0%      ~     (p=1.000 n=5+5)
mimic_gzip_decode_100k                                     143MB/s ± 0%    144MB/s ± 0%      ~     (p=0.056 n=5+5)

wuffs_png_decode_image_19k_8bpp/clang9                     111MB/s ± 0%    115MB/s ± 0%    +3.77%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang9                    147MB/s ± 0%    153MB/s ± 0%    +4.66%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9                     404MB/s ± 0%    415MB/s ± 0%    +2.75%  (p=0.016 n=5+4)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   344MB/s ± 0%    345MB/s ± 1%      ~     (p=0.151 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   329MB/s ± 0%    335MB/s ± 0%    +1.78%  (p=0.016 n=5+4)
wuffs_png_decode_image_4002k_24bpp/clang9                  148MB/s ± 0%    153MB/s ± 0%    +3.38%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                      120MB/s ± 0%    123MB/s ± 0%    +2.62%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                     153MB/s ± 0%    159MB/s ± 1%    +3.54%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10                      440MB/s ± 0%    452MB/s ± 0%    +2.82%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    357MB/s ± 0%    353MB/s ± 0%    -0.95%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    341MB/s ± 0%    341MB/s ± 0%      ~     (p=0.151 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                   157MB/s ± 0%    161MB/s ± 0%    +2.85%  (p=0.016 n=5+4)

mimic_png_decode_image_19k_8bpp                           58.1MB/s ± 0%   58.1MB/s ± 0%      ~     (p=0.389 n=5+5)
mimic_png_decode_image_40k_24bpp                          73.2MB/s ± 0%   73.2MB/s ± 0%      ~     (p=0.548 n=5+5)
mimic_png_decode_image_77k_8bpp                            177MB/s ± 0%    177MB/s ± 0%    +0.14%  (p=0.008 n=5+5)
mimic_png_decode_image_552k_32bpp_ignore_checksum               skipped
mimic_png_decode_image_552k_32bpp_verify_checksum          146MB/s ± 0%    147MB/s ± 0%    +0.13%  (p=0.016 n=5+5)
mimic_png_decode_image_4002k_24bpp                         104MB/s ± 0%    104MB/s ± 0%      ~     (p=0.556 n=5+4)
2021-03-07 12:27:45 +11:00
Nigel Tao ce97a7ccd9 Rename wuffs_base__cpu_arch__have_sse42 2021-02-18 13:44:33 +11:00
Nigel Tao 3338b5eafa Add arm_crc32,arm_neon cpu_arch conditions 2021-02-13 17:01:09 +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 73d95387f5 Change some more s/sse128/sse42/ 2021-01-24 22:04:53 +11:00
Nigel Tao 5941e7e5cc Rename sse128/sse128i to x86_sse42/x86_m128i 2021-01-24 21:58:00 +11:00
Nigel Tao 5d88f3cb37 Remove some wuffs_base__make_empty_struct calls 2021-01-22 23:01:27 +11:00
Nigel Tao 909b933695 Fix iterate end-pointer calculation 2021-01-21 09:29:32 +11:00
Nigel Tao c9221e7c27 Clear iterate slice-variables after iteration 2021-01-19 21:59:29 +11:00
Nigel Tao 020b8e6903 Add cpu_arch 2021-01-15 10:26:55 +11:00
Nigel Tao a1a70da539 Add iterate advance parameter 2021-01-11 00:03:44 +11:00
Nigel Tao 2b17cf72ca Fix uint64_t vs size_t when compiling with -m32 2021-01-08 23:07:07 +11:00
Nigel Tao dcdd7928c1 Let iterate have multiple assigns
wuffs_png_decode_19k_8bpp/clang9          92.2MB/s ± 0%  93.4MB/s ± 0%   +1.33%  (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/clang9          116MB/s ± 0%   115MB/s ± 0%     ~     (p=1.000 n=5+5)
wuffs_png_decode_77k_8bpp/clang9           347MB/s ± 0%   351MB/s ± 0%   +1.19%  (p=0.016 n=5+4)
wuffs_png_decode_552k_32bpp/clang9         150MB/s ± 0%   156MB/s ± 0%   +3.57%  (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/clang9        117MB/s ± 1%   118MB/s ± 0%   +0.62%  (p=0.008 n=5+5)

wuffs_png_decode_filter_1_sub/clang9      1.34GB/s ± 0%  1.24GB/s ± 0%   -7.30%  (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/clang9       13.3GB/s ± 0%  13.4GB/s ± 0%   +0.96%  (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/clang9   754MB/s ± 0%   948MB/s ± 0%  +25.62%  (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/clang9     127MB/s ± 0%   138MB/s ± 0%   +9.01%  (p=0.008 n=5+5)

wuffs_png_decode_19k_8bpp/gcc10            100MB/s ± 1%   100MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_png_decode_40k_24bpp/gcc10           114MB/s ± 0%   118MB/s ± 0%   +3.21%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/gcc10            323MB/s ± 2%   325MB/s ± 0%     ~     (p=0.841 n=5+5)
wuffs_png_decode_552k_32bpp/gcc10          159MB/s ± 0%   172MB/s ± 0%   +8.38%  (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/gcc10         118MB/s ± 0%   118MB/s ± 0%     ~     (p=0.056 n=5+5)

wuffs_png_decode_filter_1_sub/gcc10       1.84GB/s ± 1%  1.85GB/s ± 0%   +0.22%  (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/gcc10        10.5GB/s ± 0%  10.5GB/s ± 0%     ~     (p=0.310 n=5+5)
wuffs_png_decode_filter_3_average/gcc10    743MB/s ± 0%  1008MB/s ± 0%  +35.66%  (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/gcc10     83.1MB/s ± 0%  94.1MB/s ± 0%  +13.15%  (p=0.008 n=5+5)
2021-01-07 23:40:50 +11:00
Nigel Tao d842a20e43 Let iterate parameters be non-powers-of-2 2021-01-07 22:48:31 +11:00
Nigel Tao beaf3ef11f Add choose
wuffs_png_decode_filter_1_sub/clang9       905MB/s ± 0%  1339MB/s ± 0%  +48.05%  (p=0.008 n=5+5)
wuffs_png_decode_filter_1_sub/gcc10       1.12GB/s ± 0%  1.85GB/s ± 0%  +64.80%  (p=0.016 n=5+4)
2021-01-06 23:16:16 +11:00
Nigel Tao 43a74d6b81 Apply io_limit to original not just derived vars 2020-12-24 22:45:31 +11:00
Nigel Tao b81999f9fc Restrict an io_bind io arg to local variables only 2020-12-24 14:11:48 +11:00
Nigel Tao 78c7087eee Implement io_limit 2020-12-24 14:01:48 +11:00