返回 CodeWhale
BENCHMARKS.md
根目录 / vendor / codewhale-ratatui / BENCHMARKS.md
1 # Rendering benchmarks
2
3 ```sh
4 cargo bench --locked --bench render
5 cargo bench --locked --bench render -- --quick
6 ```
7
8 The dependency-free harness measures actual Ratatui cell buffers in release
9 mode with the native Underwater palette. It warms each scenario, runs 31
10 samples of 20 paints, and reports median and p95 **batch-average** microseconds
11 per operation. `--quick` uses five samples of two paints for a smoke run.
12
13 | Scenario | Timed work |
14 | --- | --- |
15 | Native composer | Reset and paint a prepared 112×5 composer with CJK, combining text and a ZWJ emoji |
16 | Native workbar | Reset and paint a prepared 112×5 dock with ten task rows |
17 | Session lists | Reset and paint a prepared 112×38 list with ten, 100 or 10,000 source rows; the latter two have the same visible row count |
18 | Ocean background | Clone a populated 112×38 native shell with messages, composer and workbar, then apply its first depth-column pass |
19 | Native work view | Reset, construct and draw the current showcase Work fixture |
20
21 Prepared fixtures, their source data and buffers are allocated before timing.
22 Buffer resets are included; the ocean measurement explicitly includes cloning
23 its populated input. Outputs are passed to `black_box`. No terminal writes,
24 event polling, provider work, image export or startup detection is timed.
25
26 These are local rendering measurements, not end-to-end latency or a comparison
27 with competing libraries. Batch averages smooth scheduler noise; their p95 is
28 not an individual-frame tail-latency claim. Record the machine, compiler,
29 commit and background workload when comparing runs. Use the same fixtures and
30 settings before and after an optimization, then confirm identical cell buffers.
31 CI compiles this harness and uses deterministic behavior/geometry checks;
32 wall-clock timing thresholds would be unreliable on shared runners.
33
34 ## Sample quality-pass measurements
35
36 Measured on October 1, 2026, Apple M4 Max (arm64), Rust 1.99.0, release mode.
37 Other workspace builds were active, so treat these as local samples rather
38 than portable budgets. The same harness and fixtures ran before and after
39 reusing the contrast verdict for consecutive same-color ocean text cells.
40
41 | Scenario | Before median / p95 µs | After median / p95 µs |
42 | --- | ---: | ---: |
43 | Composer, 112×5 | 10.927 / 15.873 | 10.512 / 10.906 |
44 | Workbar, 112×5 | 18.375 / 20.142 | 18.554 / 19.340 |
45 | Sessions, 100 rows | 77.123 / 82.310 | 75.079 / 79.292 |
46 | Sessions, 10,000 rows | 75.502 / 80.723 | 74.871 / 85.604 |
47 | Ocean plus fixture clone | 90.796 / 95.590 | 30.181 / 31.135 |
48 | Native Work, construction and paint | 145.077 / 156.183 | 119.348 / 128.233 |
49
50 The ocean sample's median fell about 67%; the full Work sample fell about
51 18%. Geometry, profile and per-cell contrast checks preserve the rendered
52 result. The other rows provide context for run-to-run noise; their small
53 differences are not claimed as optimizations. The 100- and 10,000-row lists
54 paint the same number of visible rows, illustrating bounded viewport work.
55
55 lines MARKDOWN