Skip to content

Enable PGO for macOS ARM64 Ruff releases - #27572

Draft
charliermarsh wants to merge 1 commit into
charlie/ruff-pgo-prototypefrom
charlie/ruff-pgo-macos-arm64
Draft

Enable PGO for macOS ARM64 Ruff releases#27572
charliermarsh wants to merge 1 commit into
charlie/ruff-pgo-prototypefrom
charlie/ruff-pgo-macos-arm64

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

Extend the existing profile-guided Ruff release pipeline to native Apple Silicon macOS builds. We build an instrumented release executable, train check and format on the same eight SHA-pinned Python ecosystem projects, and pass the merged LLVM profile into the existing maturin wheel build.

The instrumented and optimized builds retain our existing Mach-O LLD and identical-code-folding flags. The final build also disables C and C++ profiling so Apple Clang does not attempt to consume profile data produced by Rust's LLVM toolchain.

Only the aarch64-apple-darwin release job changes. Wheels and standalone archives continue to use the same optimized executable.

The native macOS release job completed successfully: profile generation took 4 minutes 39 seconds, followed by a 2-minute-37-second optimized wheel build. Compared with the matching non-PGO release artifacts, the compressed standalone artifact decreased by 1.1% and the wheel artifact decreased by 0.9%.

macOS ARM64 performance

Compared the actual non-PGO and PGO macOS ARM64 release binaries on an Apple M5 Max with eight Rayon threads. Both binaries have identical Ruff 0.16.1 source, workspace dependencies, Cargo.lock, Rust 1.97.1 toolchain, deployment target, and Mach-O linker/ICF flags. Benchmarks covered 5,396 held-out Python and stub files totaling 90.57 MB, with five warmup pairs and thirty alternating baseline/candidate pairs per workload.

Held-out project ruff check ruff format
Django 0.7% faster approximately unchanged
pandas 11.2% faster 8.3% faster
scikit-learn 6.7% faster 4.3% faster
SciPy 10.5% faster 5.8% faster
SymPy 11.9% faster 8.2% faster
Geometric mean 8.3% faster 5.4% faster

Across all ten workloads, wall time improved by 6.8% and CPU time improved by 7.8%. PGO won 257 of 300 paired wall-time comparisons and 273 of 300 paired CPU comparisons. The stripped executable decreased from 23.80 MB to 23.62 MB.

Stacked on #27570.

@charliermarsh
charliermarsh force-pushed the charlie/ruff-pgo-macos-arm64 branch from 2dbf8aa to 2d81158 Compare August 7, 2026 20:31
@charliermarsh
charliermarsh changed the base branch from charlie/ruff-bolt-prototype to charlie/ruff-pgo-prototype August 7, 2026 20:33
@astral-sh-bot

astral-sh-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 96.96%. The percentage of expected errors that received a diagnostic held steady at 92.96%. The number of fully passing files held steady at 106/133.

@astral-sh-bot

astral-sh-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@astral-sh-bot

astral-sh-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+1 -0 violations, +0 -0 fixes in 1 projects; 58 projects unchanged)

rotki/rotki (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ rotkehlchen/exchanges/okx.py:433:17: non-augmented-assignment Use `*=` to perform an augmented assignment directly

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
non-augmented-assignment 1 1 0 0 0

@charliermarsh
charliermarsh force-pushed the charlie/ruff-pgo-macos-arm64 branch from 2d81158 to 5d3c2fc Compare August 7, 2026 20:56
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.

1 participant