-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: move benchmarks into a single benchmark harness (#1302)
Consolidates the benchmarks into a single executable rather than having to create a new cargo.toml setting per and makes it easier to rearrange these when adding new benchmarks.
- Loading branch information
Showing
9 changed files
with
51 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pub mod main { | ||
pub mod barchart; | ||
pub mod block; | ||
pub mod line; | ||
pub mod list; | ||
pub mod paragraph; | ||
pub mod rect; | ||
pub mod sparkline; | ||
} | ||
pub use main::*; | ||
|
||
criterion::criterion_main!( | ||
barchart::benches, | ||
block::benches, | ||
line::benches, | ||
list::benches, | ||
paragraph::benches, | ||
rect::benches, | ||
sparkline::benches | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use criterion::{black_box, criterion_group, BenchmarkId, Criterion}; | ||
use ratatui::layout::Rect; | ||
|
||
fn rect_rows_benchmark(c: &mut Criterion) { | ||
let rect_sizes = vec![ | ||
Rect::new(0, 0, 1, 16), | ||
Rect::new(0, 0, 1, 1024), | ||
Rect::new(0, 0, 1, 65535), | ||
]; | ||
let mut group = c.benchmark_group("rect_rows"); | ||
for rect in rect_sizes { | ||
group.bench_with_input(BenchmarkId::new("rows", rect.height), &rect, |b, rect| { | ||
b.iter(|| { | ||
for row in rect.rows() { | ||
// Perform any necessary operations on each row | ||
black_box(row); | ||
} | ||
}); | ||
}); | ||
} | ||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, rect_rows_benchmark); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters