Wireshark for sorting โข htop for sorting โข Blender-level observability
Features โข Installation โข Quick Start โข Commands โข Configuration โข Plugins โข Architecture โข Benchmarks
- 13+ sorting algorithms - From Bubble to PDQSort, each fully instrumented
- 8 dataset generators - Random, reversed, nearly sorted, organ pipe, sawtooth, gaussian, adversarial
- 8 visualization modes - Bars (CAVA-style gradient), horizontal, dots, heatmap, braille, block, numeric, motion trails
- Real-time metrics - Comparisons, swaps, writes, reads, allocations, recursion depth
- Live complexity overlay - Watch O(n), O(n log n), O(nยฒ) emerge in real-time
- Full operation tracing - Every compare, swap, write, read captured with msgspec
- Statistical benchmarking - Warmup phase, outlier removal, percentile metrics
- ELO tournament arena - Algorithms compete in round-robin with ELO ratings
- Trace replay - Step forward/backward through any recorded sort with debugger-like controls
- Responsive Textual dashboard - Real-time updates at 60 FPS
- Keyboard-driven - All controls accessible without a mouse
- Theme support - Dark/light themes with rich color schemes
- Live visualization - Watch sorting algorithms execute element-by-element
- Plugin system - Add algorithms, datasets, and visualizers without modifying core
- Multi-format export - JSON, CSV, Markdown, HTML
- Session recording - Save and restore complete experiments
pip install perm # coming soon...Or install from source:
git clone https://github.com/programmersd21/perm.git cd perm pip install -e ".[dev]"
perm-ui
perm run --algorithm QuickSort --dataset Random --size 100
perm run --algorithm QuickSort --dataset Random --size 50 --viz
Cycle through visualization modes during animation:
perm run --algorithm QuickSort --dataset Random --size 50 --viz --viz-mode dots perm run --algorithm QuickSort --dataset Random --size 50 --viz --viz-mode heatmap perm run --algorithm QuickSort --dataset Random --size 50 --viz --viz-mode braille perm run --algorithm QuickSort --dataset Random --size 50 --viz --viz-mode block
Adjust animation speed:
perm run --algorithm QuickSort --dataset Random --size 100 --viz --fps 60
perm benchmark --algorithm QuickSort --dataset Random --size 10000 --iterations 10
perm arena BubbleSort QuickSort MergeSort --datasets Random Reversed --sizes 1000 5000
perm replay trace.permdata
perm export --format json --algorithm QuickSort --dataset Random --size 10000| Command | Description |
|---|---|
perm run |
Run a single sort and display results. Use --viz for CAVA-style live animation, --viz-mode to switch visualizer, --fps to control speed |
perm benchmark |
Run statistically sound benchmarks |
perm arena |
Run algorithm tournaments with ELO rankings |
perm replay |
Replay a sorting trace |
perm datasets |
List or generate datasets |
perm export |
Export benchmark results |
perm plugins |
Manage plugins |
perm config |
View or edit configuration |
perm-ui |
Launch the Textual terminal UI |
Perm uses a perm.toml configuration file:
[perm] theme = "dark" fps = 60 visualizer = "heatmap" dataset_size = 10000 benchmark_iterations = 10 benchmark_warmup = 3 trace_buffer_size = 1000000 replay_fps = 30 bar_max_elements = 200 export_dir = "./exports" plugin_dirs = ["./plugins"]
Config file search order:
$PERM_CONFIG_DIR/perm.toml./perm.toml~/.config/perm/perm.toml~/.perm.toml
Beautiful gradient bars with state-colored highlights and smooth Unicode block edges:
โโโ
โโโโโโโโ
โโโ
Gradient transitions from deep blue (bottom) โ cyan (middle) โ pale white (top).
| Keybinding | Action |
|---|---|
Space |
Play/Pause animation |
โ |
Step forward one frame |
โ |
Step backward one frame |
Home |
Jump to start |
End |
Jump to end |
q / Escape |
Quit |
Left-to-right gradient bars, each row is one element:
โโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ
ยท ยท โข โข โ โ ยท ยท โข
โ โ โ โ โ โ โ
High-density dot-matrix rendering using Unicode braille characters:
โฃโฃโฃโฃโฃคโฃฆโฃงโฃทโฃฟ
Multi-row block rendering with partial block characters:
โโโโ
โโโโ
โโ
42 17 85 3 91 56
Track element movement history with fading trails.
| Category | Algorithm | Complexity |
|---|---|---|
| Basic | Bubble Sort | O(nยฒ) |
| Basic | Selection Sort | O(nยฒ) |
| Basic | Insertion Sort | O(nยฒ) |
| Intermediate | Merge Sort | O(n log n) |
| Intermediate | Quick Sort | O(n log n) |
| Intermediate | Heap Sort | O(n log n) |
| Intermediate | Shell Sort | O(n logยฒ n) |
| Advanced | TimSort | O(n log n) |
| Advanced | IntroSort | O(n log n) |
| Advanced | PDQSort | O(n log n) |
| Advanced | Radix Sort | O(nk) |
| Advanced | Bitonic Sort | O(logยฒ n) |
| Advanced | Cycle Sort | O(nยฒ) |
Create a file in the plugins/ directory:
from perm.plugins.base import AlgorithmPlugin from perm.algorithms.base import SortAlgorithm class MySort(SortAlgorithm): name = "MySort" def sort(self, data): return sorted(data) class MyPlugin(AlgorithmPlugin): name = "my-sort" def get_algorithm(self): return MySort
See the Plugin Guide for details.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLI (Typer) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ TUI (Textual) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Algorithms โ Datasets โ Tracing โ Metrics โ
โ Visualizer โ Benchmarks โ Arena โ Replay โ
โ Exporters โ Plugins โ Config โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
See Architecture Docs for details.
QuickSort on 10,000 elements:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Mean: 1.234 ms P95: 1.456 ms โ
โ Median: 1.210 ms P99: 1.567 ms โ
โ StdDev: 0.089 ms โ
โ Comparisons: 147,210 Swaps: 42,118 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- 100,000+ elements - Handled with ease
- Millions of trace events - Efficient msgspec serialization
- 60 FPS visualization - Non-blocking async Textual rendering
- Sub-millisecond timing - Nanosecond precision instrumentation
Contributions are welcome! See the Developer Guide.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -am 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open a Pull Request
MIT
Add these 20 tags to the repository for discoverability:
sorting-visualization, sorting-algorithms, algorithm-visualization, terminal-app,
cli-tool, benchmarking, data-structures, python, textual, rich,
algorithm-analysis, performance-analysis, educational, developer-tools,
sorting-algorithm-visualizer, ascii-animation, cava-style, data-visualization,
profiling, debugger
Perm - The Sorting Observatory
Built with Python, Textual, Rich, NumPy, msgspec, and โค๏ธ
