summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2021-01-10 08:13:38 -0500
committerGitHub <noreply@github.com>2021-01-10 08:13:38 -0500
commitab5ecabe222df3f16748629b244b5e8265760d91 (patch)
treede75b625bfe722531c25dc9cb816d28af9383253
parent9e9e104664d8574c7480f0800e08326f56254f6f (diff)
Add cargo_deps to benchmarks (#9075)
-rw-r--r--cli/bench/main.rs23
1 files changed, 19 insertions, 4 deletions
diff --git a/cli/bench/main.rs b/cli/bench/main.rs
index d796237d1..012810c1f 100644
--- a/cli/bench/main.rs
+++ b/cli/bench/main.rs
@@ -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.