mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
|
|
@ -235,16 +235,30 @@ fn module_graph_is_cheap() {
|
|||
use std::time::Instant;
|
||||
|
||||
let r = root();
|
||||
|
||||
// Warm up: the first build pays cold filesystem-cache I/O (directory
|
||||
// walk + file reads) which on a loaded CI runner can swamp the actual
|
||||
// CPU cost we want to bound. Run once untimed to seed the page cache,
|
||||
// and use this build for the RSS + packages assertions.
|
||||
let bytes_before = approximate_rss_kib();
|
||||
let start = Instant::now();
|
||||
let graph = build_module_graph(std::slice::from_ref(&r));
|
||||
let elapsed = start.elapsed();
|
||||
let bytes_after = approximate_rss_kib();
|
||||
|
||||
// Time the steady-state cost as the best of several warm runs. Min,
|
||||
// not a single sample, drops scheduler / disk jitter that would
|
||||
// otherwise flake the ceiling on shared CI hosts.
|
||||
let mut best = std::time::Duration::MAX;
|
||||
for _ in 0..5 {
|
||||
let start = Instant::now();
|
||||
let g = build_module_graph(std::slice::from_ref(&r));
|
||||
best = best.min(start.elapsed());
|
||||
std::hint::black_box(&g);
|
||||
}
|
||||
|
||||
assert!(
|
||||
elapsed.as_millis() < 50,
|
||||
"build_module_graph took {}ms (>50ms ceiling)",
|
||||
elapsed.as_millis()
|
||||
best.as_millis() < 50,
|
||||
"build_module_graph took {}ms warm (>50ms ceiling)",
|
||||
best.as_millis()
|
||||
);
|
||||
|
||||
let delta_kib = bytes_after.saturating_sub(bytes_before);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue