Skip to content

AArch64: Improve sequence decoding - #4813

Open
davidbolvansky wants to merge 2 commits into
meta:devfrom
davidbolvansky:aarch64-sequence-decode-fast-path
Open

davidbolvansky wants to merge 2 commits into
meta:devfrom
davidbolvansky:aarch64-sequence-decode-fast-path

Conversation

@davidbolvansky

@davidbolvansky davidbolvansky commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Improve Apple Clang 21 decompression throughput on Apple M1 Pro by 11.3% on a 3.2 MB bundle of actual zstd C/header files, representative of compressed source archives, and 12.9% on synthetic JSON records (level-1 inputs; median of five runs). GCC 16 throughput stays within 0.4% of baseline on both inputs.

Use one shared AArch64 implementation: separate the uncommon additional literal-length-bit case, calculate the three FSE bit positions from one starting position, and update bitsConsumed once. Also extend the existing 64-bit symbol-load idiom to Clang.

Assisted-by: OpenAI Codex

Assisted-by: OpenAI Codex
@meta-cla meta-cla Bot added the CLA Signed label Oct 3, 2026
Compute FSE bit positions from a common starting position to avoid serial bitsConsumed updates and retain GCC throughput with the new length-read layout.

Assisted-by: OpenAI Codex
@davidbolvansky davidbolvansky changed the title AArch64: Improve Clang sequence decoding AArch64: Improve sequence decoding Oct 3, 2026
pps83 pushed a commit to pps83/zstd that referenced this pull request Oct 6, 2026
The windows-11-arm runner label now resolves to the
windows-11-vs2026-arm64 image (20260924), which ships Visual Studio
2026 and CMake 4.4, but no longer Visual Studio 2022. CMake fails at
configure time with "could not find any instance of Visual Studio", so
the job fails on every PR opened since 2026-10-01 (e.g. meta#4806, meta#4811,
meta#4813).

Switch that matrix entry to the "Visual Studio 18 2026" generator. The
x64 and Win32 entries run on windows-2022 and are unaffected.

Drop "VS2022" from the job name template, which would now be wrong for
the ARM64 entry: jobs become "CMake Windows (<entry>)". No branch
protection rule requires these checks by name.
@maikschulze

Copy link
Copy Markdown

I measured this PR on an Apple M4 Pro and can confirm the speedup: decompression of the Silesia dataset gets 6 to 12% faster than current dev with AppleClang 21 and AppleClang 17. With AppleClang 21, it also more than makes up for dev being slower than v1.5.7 on this machine. Clang 21.1.8 from LLVM's release gives the same picture.

macOS 26 arm64, decompression speed in MB/s, zstd -b -d -i2 on Silesia compressed at levels 1, 3 and 19, median of 5 alternating rounds. dev is 4b0e377; "dev + this PR" has the PR's two commits applied on top.

Compiler Level v1.5.7 dev dev + this PR change vs dev
AppleClang 21.0.0 (Xcode 27) 1 1,956 1,872 1,995 +6.6%
3 1,855 1,724 1,903 +10.4%
19 1,908 1,778 1,952 +9.8%
AppleClang 17.0.0 (Xcode 26.1) 1 1,702 1,865 1,984 +6.4%
3 1,564 1,718 1,917 +11.6%
19 1,621 1,794 1,984 +10.6%
How I measured
# Silesia (https://sun.aei.polsl.pl/~sdeor/corpus/silesia.zip) as one tar,
# compressed once with zstd 1.5.7
tar --format=ustar -cf silesia.tar dickens mozilla mr nci ooffice osdb reymont samba sao webster x-ray xml
for l in 1 3 19; do zstd -q -$l -T0 silesia.tar -o silesia.$l.zst; done

# each source state and compiler: zstd's Makefile with its defaults (-O3)
make -C programs zstd -j8 CC=<compiler> MOREFLAGS="-isysroot <SDK>"

# decompression only, all builds in turn, 5 rounds, median
for l in 1 3 19; do programs/zstd -b -d -i2 silesia.$l.zst; done

I used an AI assistant to run these measurements and draft this comment; I reviewed the results myself.

@davidbolvansky

Copy link
Copy Markdown
Contributor Author

@Cyan4973 anything from your side?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants