-
Notifications
You must be signed in to change notification settings - Fork 258
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(block): add benchmarks #368
Conversation
Codecov Report
@@ Coverage Diff @@
## main #368 +/- ##
=======================================
Coverage 84.99% 84.99%
=======================================
Files 40 40
Lines 8686 8686
=======================================
Hits 7383 7383
Misses 1303 1303 |
I think you probably need to have a numeric value to get the output like the paragraph (could use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'd be surprised if this really ever has significant perf issues.
To keep the benchmark times down, it's worth consolidating some of the benches. E.g. forget about the bare new()
bench. This was only necessary in the paragraph benches as we're testing some fairly large strings (~200*65535 chars) to understand the limits of scrolling and wrapping.
I suspect (without running these) that the render times are likely fairly similar (or the absolute value is small enough that the relative difference is irrelevant). In which case, it's probably sufficient to bench an empty block, and one with all the features (titles, borders, styles, padding etc.)
Can you paste some of the output metrics into the PR? It doesn't hurt to have them recorded for posterity later.
fb808a1
to
2887861
Compare
Looks good - I think Figure 4 is the one that matters the most here. And it's fast enough. |
Added benchmarks to the block widget to uncover eventual performance issues
2887861
to
a61bf39
Compare
Description
I added benchmarks to the
block
widget to uncover eventual performance issues.I tried to cover common (creation, render) or expensive (inner area) calculations. I also ran the benchmark with three different common buffer sizes.
From what I can see it doesn't seem to have any bottleneck here.
What is covered by the benches :
Block
creationDetails
This PR adds benchmarks only for
block
. I think it's a better idea to split the work on benchmarks to add them incrementally.I'm not sure the
black_box
is really necessary for theblock
creation bench. Otherwise the compiler advises to put thenew
function reference as parameter (see below). I'm afraid this is less legible and might not work as expected.paragraph
ones :I based myself off of this bench (the
paragraph
one), so I'm not sure this is the expected behavior (works in the terminal and results are correct once clicked on though).This PR relates to #137.
Thank you for your review and your work.