Performance
Cell-level diff, grapheme width, and cached component models beat reprinting the whole screen every frame. Run the benches locally to see naive Dart vs dart_tui, and kernel/AOT first-visible startup.
Why not print every frame
Reprint-the-screen loops pay for every cell on every tick. dart_tui writes only cells that changed, measures grapheme width without reallocating on every call, and keeps cached row models in components like TextArea and Viewport so update/view work stays cheap.
Run the benches
bash
make bench-hotpath
make bench-startup-pty| Workload | Naive | dart_tui | Ratio |
|---|---|---|---|
| getWidth plain x10000 | 30080 µs | 2511 µs | 12.0x |
| getWidth ANSI x10000 | 33792 µs | 3353 µs | 10.1x |
| textarea update+view x300 | 19733 µs | 3752 µs | 5.3x |
| viewport soft-wrap scroll+view x20 | 338586 µs | 17266 µs | 19.6x |
| decoder plain 100000 bytes | 6445149 µs | 3686 µs | 1748.5x |
Startup (first visible frame)
| Mode | Median first visible |
|---|---|
| JIT source | 553 ms |
| Kernel snapshot | 158 ms |
| AOT executable | 11 ms |
Microbench ratios are host-specific. Clone the repo and run
make bench-hotpath on your machine rather than treating any published number as a guarantee.For the full audit vs e00de92, see docs/performance.md.