Unverified Commit 47b0387d authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: Do multiple unit test runs (#78212)

### What?

This allows to test caching more aggressively
parent 3dc939b7
...@@ -109,22 +109,26 @@ where ...@@ -109,22 +109,26 @@ where
let start = std::time::Instant::now(); let start = std::time::Instant::now();
let first = fut(tt.clone()).await?; let first = fut(tt.clone()).await?;
println!("Run #1 took {:?}", start.elapsed()); println!("Run #1 took {:?}", start.elapsed());
println!("Run #2 (with memory cache, same TurboTasks instance)"); for i in 2..10 {
let start = std::time::Instant::now(); println!("Run #{i} (with memory cache, same TurboTasks instance)");
let second = fut(tt.clone()).await?; let start = std::time::Instant::now();
println!("Run #2 took {:?}", start.elapsed()); let second = fut(tt.clone()).await?;
assert_eq!(first, second); println!("Run #{i} took {:?}", start.elapsed());
let start = std::time::Instant::now(); assert_eq!(first, second);
tt.stop_and_wait().await; }
println!("Stopping TurboTasks took {:?}", start.elapsed());
let tt = registration.create_turbo_tasks(&name, false);
println!("Run #3 (with persistent cache if available, new TurboTasks instance)");
let start = std::time::Instant::now();
let third = fut(tt.clone()).await?;
println!("Run #3 took {:?}", start.elapsed());
let start = std::time::Instant::now(); let start = std::time::Instant::now();
tt.stop_and_wait().await; tt.stop_and_wait().await;
println!("Stopping TurboTasks took {:?}", start.elapsed()); println!("Stopping TurboTasks took {:?}", start.elapsed());
assert_eq!(first, third); for i in 10..20 {
let tt = registration.create_turbo_tasks(&name, false);
println!("Run #{i} (with persistent cache if available, new TurboTasks instance)");
let start = std::time::Instant::now();
let third = fut(tt.clone()).await?;
println!("Run #{i} took {:?}", start.elapsed());
let start = std::time::Instant::now();
tt.stop_and_wait().await;
println!("Stopping TurboTasks took {:?}", start.elapsed());
assert_eq!(first, third);
}
Ok(()) Ok(())
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment