hojicha-rendering
High-performance rendering optimization for the Hojicha TUI framework.
Features
- Differential Rendering: Only redraw changed regions of the screen
- Render Caching: Cache and reuse rendered components
- Region Coalescing: Merge overlapping dirty regions for efficiency
- Component Dependencies: Track and cascade updates through dependencies
- Checksum-based Change Detection: Detect actual content changes
Quick Start
use *;
use Rect;
// Create a differential renderer
let mut renderer = new;
// Register UI components
renderer.register_component;
renderer.register_component;
// Mark components as dirty when they change
renderer.mark_component_dirty;
// Check if rendering is needed
if renderer.component_needs_render
Performance
Based on our benchmarks:
- Mark 10 regions: 224 ns (45M ops/sec)
- Mark 100 regions: 1.78 µs (56M ops/sec)
- Mark 1000 regions: 16.9 µs (59M ops/sec)
In typical applications with 20% of components changing per frame:
- 87% reduction in render calls
- 88% reduction in terminal cell updates
- <0.01% frame time overhead
Examples
Run the performance comparison:
Architecture
The crate is organized into three main modules:
differential: Core differential rendering system with dirty region trackingcache: LRU cache for rendered componentsalgorithms: Geometric algorithms for rectangle operations
License
GPL-3.0