[Feature Request] Architecture-optimized native builds (PGO/BOLT/CPU-specific)

Resolved 💬 2 comments Opened Feb 1, 2026 by johnzfitch Closed Mar 1, 2026

Summary

Request for optimized native builds targeting modern CPU architectures across all supported platforms.

Current State

  • Native installer downloads generic baseline binaries
  • No CPU-specific optimizations (no AVX-512, no Zen tuning, no Apple Silicon optimization)
  • No PGO (Profile-Guided Optimization) applied
  • No BOLT (Binary Optimization and Layout Tool) post-processing on Linux

Requested Options

Architecture Variants

| Platform | Current | Requested Variants |
|----------|---------|-------------------|
| Linux x86-64 | GNU/Linux 3.2.0 baseline | znver4/znver5 (AMD Zen 4/5), alderlake/sapphirerapids (Intel 12th+) |
| Linux ARM64 | Generic ARMv8 | neoverse-v2, cortex-a76 (AWS Graviton, Ampere) |
| macOS ARM64 | Generic Apple Silicon | apple-m1, apple-m2, apple-m3 (native Apple tuning) |
| macOS x86-64 | Generic x86-64 | haswell, skylake (Intel Mac baseline) |
| Windows x86-64 | Generic x86-64 | znver4, alderlake (matching Linux variants) |

Optimization Techniques

  1. PGO builds: Pre-profiled binaries with representative Claude workloads
  2. BOLT-optimized builds (Linux): Post-link optimization for better I-cache utilization
  3. LTO (Link-Time Optimization): Cross-module optimization for smaller, faster binaries

Installer Enhancements

# Examples of desired installer flags
claude-installer --arch=native          # Auto-detect and use best variant
claude-installer --arch=znver5          # Explicit architecture selection
claude-installer --optimize=pgo,bolt    # Select optimization level

Expected Benefits

| Optimization | Expected Gain | Applies To |
|--------------|---------------|------------|
| Architecture-specific codegen | 5-15% | All platforms |
| PGO (Profile-Guided) | 10-20% | All platforms |
| BOLT (hot code reordering) | 5-15% | Linux only |
| LTO | 5-10% binary size, 2-5% perf | All platforms |

Combined: 15-30% faster startup and local operations

Technical Notes

Bun Single-File Executable Considerations

Claude Code uses Bun's single-file executable format, which appends the JavaScript bundle after the ELF/Mach-O structure. Optimizations must be applied before bundling:

  1. Build Bun with PGO using Claude-representative workloads
  2. Apply BOLT to Bun runtime before JS payload append
  3. Use architecture-specific compiler flags during Bun compilation

Why Users Can't Self-Optimize

  • BOLT strips the appended JS bundle, rendering the binary non-functional
  • PGO requires source access and representative workload profiling
  • Architecture flags must be set at compile time

Environment (Reporter)

  • CPU: AMD Ryzen 7 9800X3D (Zen 5, AVX-512)
  • OS: Arch Linux 6.18
  • Claude Code: 2.1.29

Related

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗