Skip to content

Accelerate SHA-256 hashing on aarch64 - #434

Closed
zaniebot wants to merge 1 commit into
mainfrom
zb/accelerate-sha256-arm
Closed

zaniebot wants to merge 1 commit into
mainfrom
zb/accelerate-sha256-arm

Conversation

@zaniebot

@zaniebot zaniebot commented Jul 29, 2026 •

Copy link
Copy Markdown
Collaborator

uv#19662 started hashing every downloaded wheel and source distribution so that a cached distribution can be reused when a later operation requires its hash. On ARM, sha2 computes those hashes in software.

Enable the sha2 assembly backend on non-Windows aarch64, allowing wheel and source distribution downloads to use ARM SHA-256 instructions. This preserves the caching behavior from uv#19662 and also speeds up uv sync, which already verified lockfile hashes before that change.

I ran uv's standard cold and warm installation benchmarks against Trio's 41 documentation dependencies on a dedicated Apple Silicon Namespace runner. Each version was measured in 40 randomized, interleaved rounds. Times are means; changes are relative to main with paired-bootstrap 95% confidence intervals from 20,000 resamples.

Wall time (ms):

Benchmark 0.11.18 0.11.19 main This change Change (95% CI)
Cold uv pip sync 602.8 689.8 709.5 646.0 -8.9% [-11.1%, -6.8%]
Cold uv sync 533.2 500.1 504.4 455.1 -9.8% [-11.5%, -8.0%]
Warm uv pip sync 264.7 263.5 270.2 258.9 -4.2% [-10.2%, +2.1%]
Warm uv sync 48.6 49.8 52.2 51.8 -0.7% [-5.0%, +3.3%]

User CPU time (ms):

Benchmark 0.11.18 0.11.19 main This change Change (95% CI)
Cold uv pip sync 232.9 300.4 299.5 245.9 -17.9% [-19.0%, -16.9%]
Cold uv sync 292.1 291.3 292.1 241.6 -17.3% [-18.3%, -16.3%]
Warm uv pip sync 15.8 15.4 16.4 15.9 -2.9% [-7.2%, +1.5%]
Warm uv sync 9.7 9.9 11.1 10.9 -2.0% [-4.4%, +0.4%]

0.11.18 predates uv#19662, and 0.11.19 includes it. That change increased cold package-install wall time by 14.4% [11.3%, 17.9%] and user CPU by 29.0% [26.5%, 32.2%]. Hardware acceleration returns package-install user CPU to within 5.6% of the original baseline while preserving distribution hashes. Warm-install intervals overlap zero.

Separately, hashing a 9.7 MiB wheel 40 times improved from 1,076.5 ms to 208.2 ms on macOS ARM (5.2×) and from 1,234.2 ms to 204.2 ms on Linux ARM (6.0×).

@zanieb
zanieb marked this pull request as ready for review July 29, 2026 23:48
@astral-automations-bot

Copy link
Copy Markdown

Promoted to #20805.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants