9 releases
Uses new Rust 2024
| 0.3.5 | Feb 15, 2026 |
|---|---|
| 0.3.4 | Jan 30, 2026 |
| 0.2.1 | Jan 3, 2026 |
| 0.1.0 | Jan 3, 2026 |
#2945 in Command line utilities
290KB
7.5K
SLoC
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
cargo install pzsh
Add to your shell
# For zsh (~/.zshrc)
eval "$(pzsh init zsh)"
# For bash (~/.bashrc)
eval "$(pzsh init bash)"
🎨 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
pzsh completion --model ~/.local/share/pzsh/model.apr
# Predictions trained on your command history
$ git c<TAB>
commit (0.85) checkout (0.72) clone (0.45)
🔧 Usage
# Initialize configuration
pzsh init --shell zsh
# Benchmark startup time
pzsh bench
# Lint for slow patterns
pzsh lint ~/.pzshrc
# Profile startup breakdown
pzsh profile
# Compile configuration
pzsh compile
# Check status
pzsh status
⚙️ Configuration
# ~/.pzshrc
[pzsh]
version = "0.2.0"
shell = "zsh"
[performance]
startup_budget_ms = 10
lazy_load = true
[prompt]
theme = "robbyrussell"
git_status = true
colors = true
[plugins]
enabled = ["git", "docker"]
[aliases]
ll = "ls -la"
gs = "git status"
[env]
EDITOR = "vim"
GOROOT = "/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
export GOROOT="$(brew --prefix golang)/libexec" # 50-100ms per call
# ALLOWED: pre-resolved paths
export GOROOT="/usr/local/opt/go/libexec" # 0ms
# FORBIDDEN: oh-my-zsh, NVM, conda init
source $ZSH/oh-my-zsh.sh # 500-2000ms
# ALLOWED: pzsh lazy loading
eval "$(pzsh init zsh)" # <1ms
🏗️ 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)
cargo test
# Run benchmarks
cargo bench
# Run with coverage
cargo llvm-cov --html
📖 Examples
# Color system demo
cargo run --example color
# Theme preview (robbyrussell, agnoster, pure, minimal)
cargo run --example theme
# Plugin system (git, docker aliases)
cargo run --example plugin
# Completion system
cargo run --example completion
# Shell initialization script
cargo run --example shell_init
# Zsh features (autocd, history, keybindings)
cargo run --example zsh_features
# Benchmark performance
cargo run --example benchmark
# Configuration parsing
cargo run --example basic_config
# Lint configuration
cargo run --example lint_config
# Prompt rendering
cargo run --example prompt
# Parser demo
cargo run --example parser
🔗 Built With
- bashrs v6.48 - Rust↔Shell transpiler
- aprender-shell v0.2 - ML completions
- trueno v0.11 - 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
Dependencies
~4–18MB
~186K SLoC