Add cargo_deps to benchmarks
@@ -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.
