Skip to content

Commit

Permalink
Fix benchmark compilation + add super deep benchmarks (#255)
Browse files Browse the repository at this point in the history
* Fix benchmark compilation + add super deep benchmarks

* cargo fmt
  • Loading branch information
nicoburns authored Nov 24, 2022
1 parent dfaec22 commit b2046b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benches/big_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ fn taffy_benchmarks(c: &mut Criterion) {

b.iter(|| taffy.compute_layout(root, Size::MAX_CONTENT).unwrap())
});

drop(group);

let mut group = c.benchmark_group("super deep trees");
group.sample_size(10);

group.bench_function("100 nodes (100-level hierarchy)", |b| {
let mut taffy = Taffy::new();
let root = build_yoga_deep_hierarchy(&mut taffy, 100, 1);
b.iter(|| taffy.compute_layout(root, Size::MAX_CONTENT).unwrap())
});

group.bench_function("1_000 nodes (1000-level hierarchy)", |b| {
let mut taffy = Taffy::new();
let root = build_yoga_deep_hierarchy(&mut taffy, 1_000, 1);
b.iter(|| taffy.compute_layout(root, Size::MAX_CONTENT).unwrap())
});
}

criterion_group!(benches, taffy_benchmarks);
Expand Down
1 change: 1 addition & 0 deletions benches/complex.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use criterion::{criterion_group, criterion_main, Criterion};
use taffy::tree::LayoutTree;

fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
let node111 = taffy
Expand Down

0 comments on commit b2046b1

Please sign in to comment.