mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
Add cargo_deps to benchmarks (#9075)
This commit is contained in:
parent
9e9e104664
commit
ab5ecabe22
1 changed files with 19 additions and 4 deletions
|
@ -405,6 +405,21 @@ fn run_max_mem_benchmark(deno_exe: &PathBuf) -> Result<Value> {
|
|||
Ok(Value::Object(results))
|
||||
}
|
||||
|
||||
fn cargo_deps() -> usize {
|
||||
let cargo_lock = test_util::root_path().join("Cargo.lock");
|
||||
let mut count = 0;
|
||||
let file = std::fs::File::open(cargo_lock).unwrap();
|
||||
use std::io::BufRead;
|
||||
for line in std::io::BufReader::new(file).lines() {
|
||||
if line.unwrap().starts_with("[[package]]") {
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
println!("cargo_deps {}", count);
|
||||
assert!(count > 10); // Sanity check.
|
||||
count
|
||||
}
|
||||
|
||||
/*
|
||||
TODO(SyrupThinker)
|
||||
Switch to the #[bench] attribute once
|
||||
|
@ -425,10 +440,6 @@ fn main() -> Result<()> {
|
|||
env::set_current_dir(&test_util::root_path())?;
|
||||
|
||||
let mut new_data: Map<String, Value> = Map::new();
|
||||
|
||||
new_data.insert("binary_size".to_string(), get_binary_sizes(&target_dir)?);
|
||||
new_data.insert("bundle_size".to_string(), bundle_benchmark(&deno_exe)?);
|
||||
|
||||
new_data.insert(
|
||||
"created_at".to_string(),
|
||||
Value::String(
|
||||
|
@ -451,6 +462,10 @@ fn main() -> Result<()> {
|
|||
),
|
||||
);
|
||||
|
||||
new_data.insert("binary_size".to_string(), get_binary_sizes(&target_dir)?);
|
||||
new_data.insert("bundle_size".to_string(), bundle_benchmark(&deno_exe)?);
|
||||
new_data.insert("cargo_deps".to_string(), Value::Number(cargo_deps().into()));
|
||||
|
||||
// TODO(ry) The "benchmark" benchmark should actually be called "exec_time".
|
||||
// When this is changed, the historical data in gh-pages branch needs to be
|
||||
// changed too.
|
||||
|
|
Loading…
Reference in a new issue