Skip to content

Commit

Permalink
improve performance test case (#8169)
Browse files Browse the repository at this point in the history
### Description

<!--
  ✍️ Write a short summary of your work.
  If necessary, include relevant screenshots.
-->

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
sokra authored May 17, 2024
1 parent 14cb94b commit 11e59b9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions crates/turbo-tasks-memory/src/aggregation/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,7 @@ fn many_children() {
}
let children_duration = start.elapsed();
println!("Children: {:?}", children_duration);
let mut number_of_slow_children = 0;
for j in 0..10 {
for j in 0.. {
let start = Instant::now();
for i in 0..CHILDREN {
let node = Node::new(50000 + j * 10000 + i);
Expand All @@ -905,8 +904,12 @@ fn many_children() {
}
let dur = start.elapsed();
println!("Children: {:?}", dur);
if dur > children_duration * 2 {
number_of_slow_children += 1;
let is_slow = dur > children_duration * 2;
if j > 10 && !is_slow {
break;
}
if j > 20 {
panic!("Adding children has become slower over time");
}
}

Expand All @@ -919,10 +922,6 @@ fn many_children() {
}
println!("Roots: {:?}", start.elapsed());

// Technically it should always be 0, but the performance of the environment
// might vary so we accept a few slow children
assert!(number_of_slow_children < 3);

check_invariants(&ctx, roots.iter().cloned().map(NodeRef));

// let root = NodeRef(roots[0].clone());
Expand Down

0 comments on commit 11e59b9

Please sign in to comment.