зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-08-28 11:36:17 +03:00
- Upgrade Criterion 0.5 → 0.8.2 - Split 4 broad bench files into 14 focused targets - Add Rust runner binary with per-target start/done logging - Add wrap_render benchmarks (all 4 WrapMode variants × 2 sizes) - Add undo_redo benchmarks (undo/redo × 3 history depths) - Apply benchmark_group + SamplingMode::Flat + reduced sample_size on slow insert cases to cut total run time from ~28 min to ~12 min - Rewrite bench/README.md to document runner, targets, and workflow
2.5 KiB
2.5 KiB
Benchmarks for tui-textarea using Criterion.rs.
Running all benchmarks (Rust runner — recommended)
The Rust runner executes every benchmark target sequentially and prints per-target start time, exit status, and wall duration.
cargo run -p tui-textarea-bench --bin runner
Example output:
[1/12] START insert_append at 2026-02-18T12:00:00Z
[1/12] DONE insert_append status=ok duration=42.31s
[2/12] START insert_random at 2026-02-18T12:00:42Z
...
All 14 benchmark targets completed successfully.
Running a single benchmark target
cargo bench -p tui-textarea-bench --bench insert_append
Available targets:
| Target | What it measures |
|---|---|
insert_append |
Appending lorem lines sequentially |
insert_random |
Inserting lorem lines at random positions |
insert_long |
Typing a long line without newlines |
search_forward |
Forward regex search |
search_backward |
Backward regex search |
cursor_char |
Character-level cursor movement |
cursor_word |
Word-level cursor movement |
cursor_paragraph |
Paragraph-level cursor movement |
cursor_edge |
Head/end and top/bottom jumps |
delete_char |
Deleting one character at a time |
delete_word |
Deleting one word at a time |
delete_line |
Deleting to line head |
wrap_render |
Rendering with Word/Glyph/WordOrGlyph wrap modes |
undo_redo |
Undo and redo traversal at varying history depths |
Filtering within a target
Pass a filter string after -- to run only matching cases:
cargo bench -p tui-textarea-bench --bench insert_append -- append::10_lorem
Comparing branches with critcmp
git checkout main
cargo bench -p tui-textarea-bench -- --save-baseline base
git checkout your-feature
cargo bench -p tui-textarea-bench -- --save-baseline change
critcmp base change
Note on cargo test -p tui-textarea-bench
Running cargo test on this package is a smoke test only — it verifies
that the benchmark code compiles and runs without panicking, but produces
no timing data. Use cargo bench or the Rust runner for real measurements.