ladybird/Userland/Libraries/LibCompress
Nico Weber d294f150ed LibGfx+LibCompress: WebPWriter performance regression reduction
This moves both Gfx::CanonicalCode::write_symbol() and
Compress::CanonicalCode::write_symbol() inline.

It also adds `__attribute__((always_inline))` on the arguments
to visit() in the latter. (ALWAYS_INLINE doesn't work on lambdas.)

Numbers with `ministat`: I ran once:

    Build/lagom/bin/image -o test.bmp Base/res/wallpapers/sunset-retro.png

and then ran to bench:

    ~/src/hack/bench.py -n 20 -o bench_foo1.txt \
        Build/lagom/bin/image -o test.webp test.bmp

...and then `ministat bench_foo1.txt bench_foo2.txt` to compare.

The previous commit increased the time for this command by 38% compared
to the before state.

With this, it's an 8.6% regression. So still a regression, but a smaller
one.

Or, in other words, this commit reduces times by 21% compared to the
previous commit.

Numbers with hyperfine are similar -- with this on top of the previous
commit, this is a 7-11% regression, instead of an almost 50% regression.

(A local branch that changes how we compute CanonicalCodes so that we
actually compress a bit is perf-neutral since the image writing code
doesn't change.)

`hyperfine 'image -o test.webp test.bmp'`:
* Before:          23.7 ms ± 0.7 ms (116 runs)
* Previous commit: 33.2 ms ± 0.8 ms (82 runs)
* This commit:     25.5 ms ± 0.7 ms (102 runs)

`hyperfine 'animation -o wow.webp giphy.gif'`:
* Before:           85.5 ms ± 2.0 ms (34 runs)
* Previous commit: 127.7 ms ± 4.4 ms (22 runs)
* This commit:      95.3 ms ± 2.1 ms (31 runs)

`hyperfine 'animation -o wow.webp 7z7c.gif'`:
* Before:          12.6 ms ± 0.6 ms (198 runs)
* Previous commit: 16.5 ms ± 0.9 ms (153 runs)
* This commit:     13.5 ms ± 0.6 ms (186 runs)
2024-05-20 13:17:34 -04:00
..
Brotli.cpp LibCompress/Brotli: Update the lookback buffer with uncompressed data 2024-01-03 17:54:36 +01:00
Brotli.h LibCompress: Let BrotliDecompressionStream take a MaybeOwned 2023-08-23 12:03:37 +01:00
BrotliDictionary.cpp AK+Lagom: Make it possible to build for iOS 2024-03-03 13:13:42 -07:00
BrotliDictionary.cpp.dict.bin LibCompress: Use a __FILE__-relative path for the brotli dictionary file 2024-01-10 09:40:51 +01:00
BrotliDictionary.h LibCompress: Implement Brotli decompressor 2022-05-21 22:41:40 +02:00
CMakeLists.txt LibCompress: Add a PackBits decoder 2023-12-27 17:40:11 +01:00
Deflate.cpp LibGfx+LibCompress: WebPWriter performance regression reduction 2024-05-20 13:17:34 -04:00
Deflate.h LibGfx+LibCompress: WebPWriter performance regression reduction 2024-05-20 13:17:34 -04:00
DeflateTables.h Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
Gzip.cpp LibCompress: Remove Gzip compress_file & decompress_file methods 2024-05-14 12:35:25 -06:00
Gzip.h LibCompress: Remove Gzip compress_file & decompress_file methods 2024-05-14 12:35:25 -06:00
Lzma2.cpp LibCompress: Avoid overflowing the size of uncompressed LZMA2 chunks 2023-03-30 14:39:31 +02:00
Lzma2.h LibCompress: Add support for LZMA2 2023-03-21 10:25:13 +01:00
Lzma.cpp Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
Lzma.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00
Lzw.h LibCompress: Add an LZW compressor 2024-05-14 12:33:53 -06:00
PackBitsDecoder.cpp LibCompress: Add a PackBits decoder 2023-12-27 17:40:11 +01:00
PackBitsDecoder.h LibCompress: Add a PackBits decoder 2023-12-27 17:40:11 +01:00
Xz.cpp LibCompress: Implement the XZ BCJ filter for ARM64 2023-12-14 08:59:23 -07:00
Xz.h LibCompress: Implement the XZ BCJ filter for ARM64 2023-12-14 08:59:23 -07:00
Zlib.cpp LibCompress: Port ZlibDecompressor to AK::Stream 2023-08-23 12:03:37 +01:00
Zlib.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00