Commit Graph
468 Commits
Author SHA1 Message Date
Nigel Tao 2f65d6fc74 Use go:embed instead of ".../internal/cgen/data" 2021-08-22 12:52:52 +10:00
Nigel Tao 226c476994 Remove calls to Go's deprecated "io/ioutil" 2021-08-22 11:17:34 +10:00
Nigel Tao ea50956b5a Ignore "-Wimplicit-fallthrough" 2021-07-05 21:40:25 +10:00
Nigel Tao 76e6872498 Have clang-cl ignore unused-function etc warnings 2021-06-25 13:51:27 +10:00
Nigel Tao 543ac9af28 Restrict "ignore -Wold-style-cast" to C++ 2021-04-02 22:43:55 +11:00
Nigel Tao 97e30c29da Add some more #pragma's for GCC to ignore warnings 2021-04-02 19:21:54 +11:00
Nigel Tao ad40102c5a Change mimic marker symbol from "!!" to "¿" 2021-03-25 22:22:27 +11:00
Nigel Tao bb2e9e90b5 Change cgen marker symbol from "!!" to "¡" 2021-03-25 22:17:26 +11:00
Nigel Tao 61635213cd Add "‼" to "WUFFS C HEADER ENDS HERE" comment 2021-03-25 14:11:23 +11:00
Nigel Tao f2ed33375c Gate wuffs_aux on WUFFS_BASE__HAVE_UNIQUE_PTR 2021-03-11 10:52:49 +11:00
Nigel Tao cf6c578973 Add aux library 2020-08-04 23:43:38 +10:00
Nigel Tao 533b84b3b1 Simplify WUFFS_VERSION_ETC macros 2020-06-11 23:01:50 +10:00
Nigel Tao d5d4da0ab6 Add some "// --------" section-break comments 2020-06-05 00:10:31 +10:00
Nigel Tao 3efb204f4e Drop wuffs-c genrelease's exec of the C-formatter
genrelease essentially concatenates the individual packages' generated C
files, which should already be formatted.

----
$ # Before.
$ time wuffs gen > /dev/null
real	0m2.622s
user	0m2.457s
sys	0m0.266s

$ # After.
$ time wuffs gen > /dev/null
real	0m1.433s
user	0m1.335s
sys	0m0.191s
----
2020-06-03 13:46:24 +10:00
Nigel Tao 16c1f3cfd7 Clean up some wuffs-c output (before clang-format) 2020-06-03 13:36:04 +10:00
Nigel Tao ddc8973ef0 Let wuffs-c take a no-op C formatter
Reinforcing the previous commit's (e5cc4a42) observation, over 93% of
compilation time (converting foo.wuffs into foo.c) is spent piping the
generated C code through clang-format.

----
$ time wuffs gen -cformatter=clang-format-5.0 > /dev/null
real	0m2.855s
user	0m2.680s
sys	0m0.286s

$ time wuffs gen -cformatter=                 > /dev/null
real	0m0.175s
user	0m0.172s
sys	0m0.050s
----
2020-06-03 13:21:53 +10:00
Nigel Tao e5cc4a42e4 Measure how much of "wuffs gen" is clang-format
----
$ time wuffs gen
       1 milliseconds generating the C code
     753 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-base.c
       0 milliseconds generating the C code
      19 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-adler32.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/adler32.wuffs
       1 milliseconds generating the C code
      61 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-bmp.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/bmp.wuffs
       1 milliseconds generating the C code
      78 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-crc32.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/crc32.wuffs
       2 milliseconds generating the C code
      93 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-deflate.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/deflate.wuffs
       0 milliseconds generating the C code
      34 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-lzw.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/lzw.wuffs
       4 milliseconds generating the C code
     203 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-gif.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/gif.wuffs
       0 milliseconds generating the C code
      33 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-gzip.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/gzip.wuffs
       4 milliseconds generating the C code
     135 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-json.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/json.wuffs
       0 milliseconds generating the C code
      44 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-wbmp.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/wbmp.wuffs
       0 milliseconds generating the C code
      32 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-zlib.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/zlib.wuffs
       3 milliseconds collecting the C code
    1173 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/release/c/wuffs-unsupported-snapshot.c

real	0m2.849s
user	0m2.674s
sys	0m0.278s
----
2020-06-03 12:30:47 +10:00
Nigel Tao 092b03cd1e Add WUFFS_CONFIG__MODULE__BASE__ETC sub-modules
$ ls -l gen/lib/c/*/{lib*,*base*} | awk '{print $5 " " $9}'

Before:
167976 gen/lib/c/clang-5.0-dynamic/libwuffs.so
 40824 gen/lib/c/clang-5.0-dynamic/wuffs-base.lo
203306 gen/lib/c/clang-5.0-static/libwuffs.a
 41816 gen/lib/c/clang-5.0-static/wuffs-base.o
188080 gen/lib/c/gcc-dynamic/libwuffs.so
 53976 gen/lib/c/gcc-dynamic/wuffs-base.lo
230002 gen/lib/c/gcc-static/libwuffs.a
 53976 gen/lib/c/gcc-static/wuffs-base.o

After:
168024 gen/lib/c/clang-5.0-dynamic/libwuffs.so
 20664 gen/lib/c/clang-5.0-dynamic/wuffs-base-core.lo
 10784 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
 11640 gen/lib/c/clang-5.0-dynamic/wuffs-base-pixconv.lo
205752 gen/lib/c/clang-5.0-static/libwuffs.a
 20960 gen/lib/c/clang-5.0-static/wuffs-base-core.o
 11024 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
 12096 gen/lib/c/clang-5.0-static/wuffs-base-pixconv.o
188128 gen/lib/c/gcc-dynamic/libwuffs.so
 18936 gen/lib/c/gcc-dynamic/wuffs-base-core.lo
 10672 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
 27232 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
232984 gen/lib/c/gcc-static/libwuffs.a
 18920 gen/lib/c/gcc-static/wuffs-base-core.o
 10640 gen/lib/c/gcc-static/wuffs-base-f64conv.o
 27216 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2020-05-25 23:01:11 +10:00
Nigel Tao 1a1f36ce13 Disable clang's -Wunreachable-code warning 2020-04-03 21:57:49 +11:00
Nigel Tao 03f0d84a3a Remove -Werror from "wuffs test/bench" 2019-11-30 15:32:05 +11:00
Nigel Tao d501daddc3 Rename [i..j] to [i ..= j], the same as Rust 2019-10-12 18:40:53 +11:00
Nigel Tao 6826f2f748 Move internal/cgen up a couple of directories 2019-03-09 13:28:59 +11:00
Nigel Tao 489284dfda Remove the deprecated foo__check_wuffs_version 2019-03-09 11:11:41 +11:00
Nigel Tao c4b8a6a4cc Don't use designated initializers
Some C/C++ compilers, such as MSVC, don't always support them. They're
also not supported by GCC's "g++ -std=c++11 -Wpedantic".
2019-03-09 10:08:00 +11:00
Nigel Tao fbd1ae8391 Disable -Wmaybe-uninitialized for GCC 2019-02-24 17:22:14 +11:00
Nigel Tao ffeb2bff63 Split benchmarks for full / partial initialization 2019-02-24 16:54:19 +11:00
Nigel Tao dd861416ff Allow calling pure functions after seeing an error
Updates #20
2019-02-24 11:13:51 +11:00
Nigel Tao 045f180a6c Rename errors from "?msg" to "#msg" 2019-02-23 17:06:24 +11:00
Nigel Tao 8b2c948f1b Work around clang memset / branch performance
name                                             old speed      new speed      delta

wuffs_deflate_decode_1k/clang5                    163MB/s ± 0%   163MB/s ± 0%    ~     (p=0.151 n=5+5)
wuffs_deflate_decode_10k/clang5                   230MB/s ± 1%   234MB/s ± 0%  +1.60%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/clang5    262MB/s ± 1%   265MB/s ± 0%  +0.97%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/clang5   220MB/s ± 0%   221MB/s ± 0%  +0.59%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k/gcc7                      193MB/s ± 1%   194MB/s ± 0%    ~     (p=0.151 n=5+5)
wuffs_deflate_decode_10k/gcc7                     276MB/s ± 1%   276MB/s ± 1%    ~     (p=0.690 n=5+5)
wuffs_deflate_decode_100k_just_one_read/gcc7      325MB/s ± 0%   324MB/s ± 1%    ~     (p=0.690 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/gcc7     258MB/s ± 1%   258MB/s ± 0%    ~     (p=0.690 n=5+5)

wuffs_gif_decode_1k_bw/clang5                     430MB/s ± 1%   445MB/s ± 1%  +3.58%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/clang5                  186MB/s ± 1%   192MB/s ± 0%  +3.17%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang5                  729MB/s ± 1%   748MB/s ± 1%  +2.53%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang5               196MB/s ± 1%   202MB/s ± 1%  +2.71%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang5                       242MB/s ± 2%   251MB/s ± 0%  +3.54%  (p=0.016 n=5+4)
wuffs_gif_decode_100k_artificial/clang5           539MB/s ± 1%   545MB/s ± 1%    ~     (p=0.095 n=5+5)
wuffs_gif_decode_100k_realistic/clang5            221MB/s ± 0%   226MB/s ± 1%  +2.32%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang5                     224MB/s ± 0%   230MB/s ± 1%  +2.28%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang5           1.06GB/s ± 0%  1.07GB/s ± 1%  +1.31%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc7                       478MB/s ± 0%   467MB/s ± 0%  -2.27%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/gcc7                    194MB/s ± 0%   196MB/s ± 0%  +0.94%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc7                    635MB/s ± 1%   639MB/s ± 1%    ~     (p=0.056 n=5+5)
wuffs_gif_decode_10k_indexed/gcc7                 200MB/s ± 1%   202MB/s ± 1%    ~     (p=0.095 n=5+5)
wuffs_gif_decode_20k/gcc7                         242MB/s ± 1%   243MB/s ± 1%    ~     (p=0.421 n=5+5)
wuffs_gif_decode_100k_artificial/gcc7             509MB/s ± 0%   510MB/s ± 0%    ~     (p=1.000 n=5+5)
wuffs_gif_decode_100k_realistic/gcc7              210MB/s ± 0%   211MB/s ± 0%  +0.50%  (p=0.016 n=5+5)
wuffs_gif_decode_1000k/gcc7                       214MB/s ± 0%   214MB/s ± 0%    ~     (p=0.151 n=5+5)
wuffs_gif_decode_anim_screencap/gcc7             1.03GB/s ± 0%  1.03GB/s ± 1%    ~     (p=0.421 n=5+5)

wuffs_lzw_decode_20k/clang5                       263MB/s ± 1%   267MB/s ± 2%    ~     (p=0.151 n=5+5)
wuffs_lzw_decode_100k/clang5                      427MB/s ± 1%   451MB/s ± 2%  +5.61%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc7                         270MB/s ± 0%   268MB/s ± 0%  -0.66%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc7                        481MB/s ± 1%   483MB/s ± 1%    ~     (p=0.222 n=5+5)
2019-02-23 12:47:41 +11:00
Nigel Tao 2952f130f6 Fold a memset call into an initialize call 2019-02-16 14:28:47 +11:00
Nigel Tao 02563641da Eliminate a wuffs_base__return_empty_struct call 2019-02-16 14:23:24 +11:00
Nigel Tao b41f121d20 Make "uninitialized internal buffers" explicit 2019-02-16 14:02:32 +11:00
Nigel Tao ff399c0e78 Delete wuffs_base__pixel_config::initialize 2019-02-16 09:04:59 +11:00
Nigel Tao ab7d6de318 Let Wuffs compile with MSVC (Microsoft Visual C++) 2019-02-16 09:02:33 +11:00
Nigel Tao 0ab52c6204 Move cgen's sub-structs to private_data
name                                             old speed      new speed      delta

wuffs_gif_decode_1k_bw/clang5                     243MB/s ± 1%   243MB/s ± 1%    ~     (p=0.101 n=47+48)
wuffs_gif_decode_1k_color/clang5                  142MB/s ± 1%   142MB/s ± 1%  +0.36%  (p=0.000 n=48+47)
wuffs_gif_decode_10k_bgra/clang5                  734MB/s ± 1%   728MB/s ± 1%  -0.78%  (p=0.000 n=46+50)
wuffs_gif_decode_10k_indexed/clang5               197MB/s ± 0%   196MB/s ± 1%  -0.52%  (p=0.000 n=47+46)
wuffs_gif_decode_20k/clang5                       250MB/s ± 1%   249MB/s ± 1%    ~     (p=0.189 n=49+46)
wuffs_gif_decode_100k_artificial/clang5           556MB/s ± 1%   555MB/s ± 1%  -0.23%  (p=0.000 n=46+44)
wuffs_gif_decode_100k_realistic/clang5            229MB/s ± 1%   229MB/s ± 0%    ~     (p=0.055 n=48+48)
wuffs_gif_decode_1000k/clang5                     233MB/s ± 1%   234MB/s ± 0%  +0.30%  (p=0.000 n=48+45)
wuffs_gif_decode_anim_screencap/clang5           1.11GB/s ± 1%  1.10GB/s ± 0%  -0.28%  (p=0.000 n=46+47)

wuffs_gif_decode_1k_bw/gcc7                       257MB/s ± 2%   263MB/s ± 1%  +2.67%  (p=0.000 n=49+47)
wuffs_gif_decode_1k_color/gcc7                    142MB/s ± 1%   146MB/s ± 1%  +3.25%  (p=0.000 n=50+49)
wuffs_gif_decode_10k_bgra/gcc7                    627MB/s ± 1%   625MB/s ± 1%  -0.35%  (p=0.000 n=48+49)
wuffs_gif_decode_10k_indexed/gcc7                 197MB/s ± 1%   196MB/s ± 1%  -0.21%  (p=0.000 n=48+43)
wuffs_gif_decode_20k/gcc7                         239MB/s ± 0%   239MB/s ± 1%  +0.21%  (p=0.000 n=50+47)
wuffs_gif_decode_100k_artificial/gcc7             511MB/s ± 0%   512MB/s ± 1%  +0.21%  (p=0.000 n=49+44)
wuffs_gif_decode_100k_realistic/gcc7              211MB/s ± 0%   212MB/s ± 1%  +0.39%  (p=0.000 n=45+44)
wuffs_gif_decode_1000k/gcc7                       215MB/s ± 0%   216MB/s ± 1%  +0.13%  (p=0.002 n=46+48)
wuffs_gif_decode_anim_screencap/gcc7             1.06GB/s ± 1%  1.06GB/s ± 1%  +0.12%  (p=0.007 n=45+48)

wuffs_lzw_decode_20k/clang5                       271MB/s ± 1%   270MB/s ± 1%  -0.34%  (p=0.000 n=49+49)
wuffs_lzw_decode_100k/clang5                      480MB/s ± 1%   478MB/s ± 1%  -0.31%  (p=0.001 n=48+50)

wuffs_lzw_decode_20k/gcc7                         263MB/s ± 1%   264MB/s ± 1%  +0.38%  (p=0.000 n=45+47)
wuffs_lzw_decode_100k/gcc7                        476MB/s ± 1%   482MB/s ± 2%  +1.30%  (p=0.000 n=47+50)
2019-02-10 11:22:04 +11:00
Nigel Tao 664c47fe3c Have initialize zero private_impl but not _data 2019-02-09 19:54:29 +11:00
Nigel Tao 250257e3c0 Spin out some cgen fields to a private_data struct 2019-02-09 19:49:09 +11:00
Nigel Tao 4f76d2f893 Rename some check_wuffs_version status messages 2019-02-09 14:56:27 +11:00
Nigel Tao 451301137f Look for WUFFS_INITIALIZE__ALREADY_ZEROED 2019-02-09 14:48:15 +11:00
Nigel Tao f8daf3d219 Add contains_range and contains_rect methods 2019-02-09 13:42:17 +11:00
Nigel Tao 8794a586ac Add wuffs_foo__bar__initialize methods 2019-02-09 12:54:02 +11:00
Nigel Tao 10ead58e2e Add temporary wuffs_base__pixel_config::initialize 2019-02-09 11:45:01 +11:00
Nigel Tao 957182fde7 Re-arrange coro_susp_point's and coro stacks 2019-02-09 11:15:56 +11:00
Nigel Tao 9518af5a95 Separate the coro_susp_point from the coro stack 2019-02-09 11:03:50 +11:00
Nigel Tao f877fb2c59 Use the workbuf instead of lzw.decoder.suffixes
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.

name                                     old speed      new speed      delta

wuffs_lzw_decode_20k/clang5               255MB/s ± 0%   241MB/s ± 0%   -5.63%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang5              418MB/s ± 1%   401MB/s ± 1%   -4.02%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc7                 255MB/s ± 1%   235MB/s ± 0%   -7.88%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc7                444MB/s ± 1%   382MB/s ± 0%  -13.90%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/clang5             239MB/s ± 2%   235MB/s ± 1%   -1.89%  (p=0.016 n=5+5)
wuffs_gif_decode_1k_color/clang5          135MB/s ± 0%   132MB/s ± 0%   -1.86%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang5          692MB/s ± 1%   678MB/s ± 0%   -2.08%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang5       186MB/s ± 0%   181MB/s ± 0%   -2.58%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang5               237MB/s ± 1%   226MB/s ± 0%   -4.46%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang5   536MB/s ± 0%   506MB/s ± 0%   -5.53%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang5    219MB/s ± 0%   203MB/s ± 1%   -7.11%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang5             222MB/s ± 0%   206MB/s ± 0%   -7.25%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang5   1.07GB/s ± 0%  1.04GB/s ± 1%   -3.11%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc7               262MB/s ± 0%   255MB/s ± 1%   -2.63%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/gcc7            142MB/s ± 1%   137MB/s ± 1%   -3.38%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc7            596MB/s ± 1%   593MB/s ± 0%     ~     (p=0.151 n=5+5)
wuffs_gif_decode_10k_indexed/gcc7         185MB/s ± 0%   182MB/s ± 2%   -1.63%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc7                 230MB/s ± 0%   226MB/s ± 0%   -1.78%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc7     490MB/s ± 1%   488MB/s ± 0%     ~     (p=0.095 n=5+5)
wuffs_gif_decode_100k_realistic/gcc7      203MB/s ± 1%   203MB/s ± 0%     ~     (p=0.421 n=5+5)
wuffs_gif_decode_1000k/gcc7               207MB/s ± 0%   207MB/s ± 0%     ~     (p=1.000 n=5+5)
wuffs_gif_decode_anim_screencap/gcc7     1.04GB/s ± 0%  1.03GB/s ± 0%   -0.83%  (p=0.008 n=5+5)
2019-02-03 14:57:34 +11:00
Nigel Tao d1f1340d47 Add a nothing built-in literal 2019-02-03 14:01:19 +11:00
Nigel Tao 54a112a130 Skip generating wuffs_base__utility typed fields 2019-02-02 16:47:04 +11:00
Nigel Tao dcf91f6c7e Move wuffs_base__utility__null_slice_u8 to private 2019-02-02 16:44:41 +11:00
Nigel Tao 852a979d2f Remove the cgen receiver for base.utility methods 2019-02-02 16:43:07 +11:00
Nigel Tao 5f7c807729 Generate macros for public scalar consts 2019-02-02 16:17:10 +11:00