-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test: Add benchmarking for widgets #137
Comments
I've looked at the linked issue, and tried to add a bench (for #[bench]
fn bench_title_rounded_corners(b: &mut test::Bencher) {
b.iter(|| {
Block::default()
.borders(Borders::ALL)
.title("Main block with round corners")
.title_alignment(Alignment::Center)
.border_type(BorderType::Rounded)
})
} Does this look okay? I just took one of the example usages of |
It's a good start. Most of the work for widgets is done in rendering, so I think it would be a good idea to set up a buffer outside of the measured func, and render to that buffer in the measured code. |
When benching the rendering of widgets, should I use the |
I don't know if you even need a backend tbh - doing something like
Should capture the time it takes to render, and doesn't induce any backend related overhead. (you may need to twiddle some of above, buf may need to be cloned for example, but that's the approach I'd start with). |
Got it. Thanks! |
Are you working on this @Sufilevy (or anyone else) ? Otherwise I'm interested in submitting a PR. |
You're welcome to! |
Added benchmarks to the block widget to uncover eventual performance issues ratatui#137
Added benchmarks to the block widget to uncover eventual performance issues ratatui#137
Added benchmarks to the block widget to uncover eventual performance issues ratatui#137
Most widgets are created on every render, so I think they should also be included in the benchmarks. Either they are fast and no problem or an issue shows up. |
Problem
There might be performance issues/concerns about tui widgets and adding benchmarks is important to uncover them.
Solution
Add benches for widgets. See #22 for an example.
Alternatives
None.
Additional context
#22
The text was updated successfully, but these errors were encountered: