diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-09-11 11:00:13 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2020-09-11 21:00:15 +0200 |
| commit | 41f244bd2ff0a217a83a3d17fc82f4a773eca278 (patch) | |
| tree | 729b595333edc06a8379f03215fd6cf424f7a627 /src-self-hosted/Module.zig | |
| parent | 0833c8d06ba9a467bb8449cbca2ba6f43d218c32 (diff) | |
| download | zig-41f244bd2ff0a217a83a3d17fc82f4a773eca278.tar.gz zig-41f244bd2ff0a217a83a3d17fc82f4a773eca278.zip | |
std: Make the DEFLATE decompression routine 3x faster
A profiler run showed that the main bottleneck was the naive decoding of
the Huffman codes, replacing it with a nice trick borrowed by Zlib gave
a substantial speedup.
Replacing a `%` with a `and (mask-1)` gave another significant
improvement (yay for low hanging fruits).
A few numbers obtained by decompressing a 22M file:
Before:
```
./decompress 2,39s user 0,00s system 99% cpu 2,400 total
```
After:
```
./decompress 0,79s user 0,00s system 99% cpu 0,798 total
````
Diffstat (limited to 'src-self-hosted/Module.zig')
0 files changed, 0 insertions, 0 deletions
