Repository navigation
perf: replace libdeflate with ISA-L; StepCache and archives on built-in zstd - #2793
Merged
Merged
Conversation
…in zstd - Wire compression and UOP reads use IGzip.Bindings (ISA-L) instead of LibDeflate.Bindings. - StepCache format v10: each record is a zstd L19 frame compressed against a 64 KB dictionary trained on every 7th record and stored after the header. Map 0: 15.70 MiB vs 15.78 (libdeflate L12), bake 32s vs 60s, reads ~25% faster. v9 files are re-baked once. - ManagedArchive uses System.IO.Compression.ZstandardStream; ZstdNet removed. Same libzstd 1.5.7: identical output and speed, existing .tar.zst backups still extract. - CI, BuildTool prerequisite checker and docs install libisal2 (apt) / isa-l (dnf, apk); macOS needs brew isa-l only on Intel, Apple Silicon uses the bundled copy. - Remove ClothingRaceTests, which did not compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.swbfiles are treated as missing and re-baked once.ManagedArchiveuses .NET 11'sZstandardStream; the ZstdNet package is removed.platform-prerequisites.mdnow listlibisal2(apt) /isa-l(dnf, apk). IGzip bundles natives for win-x64 and osx-arm64, so only Intel Macs needbrew install isa-l.ClothingRaceTestsis removed: it did not compile (missing usings).Benchmarks
All numbers are BenchmarkDotNet runs pinned to one core on Windows x64. Compression time is per call.
Wire compression: libdeflate L6 (old default) vs ISA-L L1 (new)
Compression runs on the game loop for every send, so a gump send costs ~3.4x less loop time for ~13% more bytes.
Other encoders on the gump send (layout + text):
ZLibEncoder)Every zlib-ng level was beaten on both time and size by some libdeflate level. Levels 2–3 of ISA-L barely shrink the output and L3 doubles the time.
Against the zlib that RunUO and ServUO ship
RunUO (zlib 1.2.3) and ServUO (zlib 1.2.11) both compress gumps on the game thread with
compress2at the default level (6). House designs go to a background thread. Same payloads and pinned core as above, in one run:ISA-L compresses a gump send ~7.5x faster than ServUO and ~8.5x faster than RunUO, for ~10% more bytes. Compressing a house plane on the game thread now costs less than the background-thread compression in either.
Decompression (load-time: UOP multis; tests: gumps)
Within about 10% either way.
StepCache (map 0: 114,688 records, 117.3 MiB raw)
Training the dictionary adds 0.5 s to the bake. Each record is only 256 cells, so most of the redundancy is between records. A dictionary captures that while still letting each chunk be read on its own, which is why the earlier dictionary-free zstd spike lost to libdeflate.
Archives: ZstdNet vs built-in
ZstandardStream(31.6 MiB tar of a world save)Both libraries wrap libzstd 1.5.7, so the output is byte-for-byte the same size. Archives made by either one decompress with the other, so existing
.tar.zstbackups still extract.Linux packages
libisal.so.2checked with Docker on every image in the CI matrix: Ubuntu 22/26 and Debian 12/13 (libisal2, ISA-L 2.30–2.31), Fedora 44 (isa-l2.32.1), CentOS Stream 9/10 and AlmaLinux 10 (isa-l2.32.1 from EPEL). IGzip.Bindings' own CI covers Ubuntu 24, Alpine and Arch, plus the struct layout across 2.28–2.32.1.Test plan