pzsh
Performance-first shell framework with sub-10ms startup. Like oh-my-zsh, but 50-200x faster.
⚡ Demo
┌─────────────────────────────────────────────────────────────┐
│ noah@dev ~/src/pzsh (main) │
│ ❯ pzsh bench │
│ │
│ Startup Benchmark (100 iterations) │
│ ──────────────────────────────── │
│ min: 0.002ms ████ │
│ max: 0.003ms ████ │
│ mean: 0.003ms ████ │
│ p99: 0.003ms ████ │
│ ──────────────────────────────── │
│ Budget: 10ms ✓ (p99 < 10ms) │
└─────────────────────────────────────────────────────────────┘
Core Invariant
No shell startup shall exceed 10ms. This is not a goal—it is a hard constraint enforced at compile time, test time, and runtime.
🚀 Performance
| Framework | Startup | vs pzsh |
|---|---|---|
| pzsh | <1ms | 1x |
| bare zsh | 5-10ms | 10x |
| zinit | 100-300ms | 300x |
| prezto | 200-500ms | 500x |
| oh-my-zsh | 500-2000ms | 2000x |
Benchmark Output
Startup Benchmark (100 iterations)
────────────────────────────────
min: 0.002ms
max: 0.003ms
mean: 0.003ms
p50: 0.003ms
p95: 0.003ms
p99: 0.003ms
────────────────────────────────
Budget: 10ms ✓ (p99 < 10ms)
Profile Breakdown
Startup Profile
├─ parse: 0.007ms
├─ env: 0.000ms
├─ alias: 0.000ms
├─ prompt: 0.005ms
└─ total: 0.013ms ✓
📦 Installation
Add to your shell
# For zsh (~/.zshrc)
# For bash (~/.bashrc)
🎨 Features
oh-my-zsh Compatibility
pzsh provides drop-in replacements for common oh-my-zsh features:
- Git plugin -
g,ga,gc,gp,gstaliases - Docker plugin -
d,di,dps,dexaliases - Colored prompts - Git branch with dirty status
- Themes - robbyrussell, agnoster, pure, minimal
Prompt Preview
┌──────────────────────────────────────────────────────────┐
│ robbyrussell theme │
│ ➜ ~/src/pzsh (main*) git status │
├──────────────────────────────────────────────────────────┤
│ agnoster theme │
│ noah │ dev │ ~/src/pzsh │ main* │ ❯ │
├──────────────────────────────────────────────────────────┤
│ pure theme │
│ ~/src/pzsh main* │
│ ❯ │
├──────────────────────────────────────────────────────────┤
│ minimal theme │
│ > ls -la │
└──────────────────────────────────────────────────────────┘
ML-Powered Completions
Optional integration with aprender-shell for intelligent command predictions:
# Load your trained model
# Predictions trained on your command history
) ) )
🔧 Usage
# Initialize configuration
# Benchmark startup time
# Lint for slow patterns
# Profile startup breakdown
# Compile configuration
# Check status
⚙️ Configuration
# ~/.pzshrc
[]
= "0.2.0"
= "zsh"
[]
= 10
= true
[]
= "robbyrussell"
= true
= true
[]
= ["git", "docker"]
[]
= "ls -la"
= "git status"
[]
= "vim"
= "/usr/local/opt/go/libexec" # Pre-resolved, no $(brew ...)
🚫 Forbidden Patterns
pzsh enforces O(1) startup by rejecting slow patterns:
# FORBIDDEN: subprocess calls at startup
# 50-100ms per call
# ALLOWED: pre-resolved paths
# 0ms
# FORBIDDEN: oh-my-zsh, NVM, conda init
# ALLOWED: pzsh lazy loading
🏗️ Architecture
┌─────────────────────────────────────────┐
│ pzsh init zsh │
├─────────────────────────────────────────┤
│ Parser │ O(1) LRU cache │ 2ms │
│ Executor │ O(1) hash lookup │ 2ms │
│ Prompt │ Async git status │ 2ms │
│ Config │ Pre-compiled │ 0ms │
├─────────────────────────────────────────┤
│ Total Budget │ 10ms │
└─────────────────────────────────────────┘
🧪 Testing
# Run all tests (335 tests, 97% coverage)
# Run benchmarks
# Run with coverage
🔗 Built With
- bashrs v6.48 - Rust↔Shell transpiler
- aprender-shell v0.2 - ML completions
- trueno v0.10 - SIMD acceleration
📚 Toyota Way
Development follows the Toyota Production System:
- Andon - Stop the line on defects
- Kaizen - Continuous improvement
- Genchi Genbutsu - Go and see for yourself
📄 License
MIT