mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Compile time:
$ time ./build-example.sh
Before: user 1m15.750s
After: user 0m50.343s
Binary size (excluding the statically linked example-toy-genlib):
$ ls -l gen/bin/example-* | awk '{print $5 " " $9}'
Before:
212624 gen/bin/example-cbor-to-json
284192 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
184304 gen/bin/example-gifplayer
324952 gen/bin/example-imageviewer
209632 gen/bin/example-json-to-cbor
241432 gen/bin/example-jsonfindptrs
196320 gen/bin/example-jsonptr
309768 gen/bin/example-sdl-imageviewer
200704 gen/bin/example-zcat
After:
85280 gen/bin/example-cbor-to-json
242216 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
53328 gen/bin/example-gifplayer
282840 gen/bin/example-imageviewer
95152 gen/bin/example-json-to-cbor
122720 gen/bin/example-jsonfindptrs
60448 gen/bin/example-jsonptr
267672 gen/bin/example-sdl-imageviewer
64792 gen/bin/example-zcat
Before total: 2508672
After total: 1619192
C Base Code
This directory (base) and its sibling
(auxiliary) contain C and C++ code respectively.
This C/C++ code combines with the transpiled-to-C/C++ form of the Wuffs code in
the top-level std directory to create the "single file C/C++ library"
form of the Wuffs standard library.
- From Wuffs-the-language's point of view, this directory contains
implementations of the built-in
basepackage types, such as I/O buffers, ranges and rects and statuses. - From application code's point of view (Wuffs is for writing libraries not
applications), this directory also contains helper functions for working with
those
basetypes, such as constructing an I/O buffer from a pointer and a length, that aren't relevant to Wuffs-the-language code. - This directory also contains some functionality (e.g. pixel conversion and
string conversion) that, in the future, could possibly be Wuffs packages
under
std. For optimal performance, they sometimes require programming language features (e.g. function-pointer typed variables, SIMD acceleration) that are not yet available in Wuffs-the-language (or were not available at the time they were added). In the short term, it was more practical to implement them in carefully hand-written C/C++, in this directory. In the long term, they could migrate out ofbaseto be understd, but anybaseAPI removal would require a Wuffs version number bump.
Making Changes
After editing source code in this directory, to see those changes when generating the C/C++ form of Wuffs' standard library:
go install github.com/google/wuffs/cmd/wuffs-c && wuffs gen base
This should modify the
wuffs-unsupported-snapshot.c file.