1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

bench: don't send data to grafana (#16324)

ci / bench release ubuntu-20.04-xl (pull_request) went from 24m to 23m
This commit is contained in:
Bartek Iwańczuk 2022-10-17 17:49:03 +02:00 committed by GitHub
parent eee323ff0d
commit 60dd84a5a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 330 deletions

253
Cargo.lock generated
View file

@ -352,18 +352,6 @@ dependencies = [
"alloc-stdlib",
]
[[package]]
name = "bstr"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
dependencies = [
"lazy_static",
"memchr",
"regex-automata",
"serde",
]
[[package]]
name = "bumpalo"
version = "3.11.0"
@ -641,28 +629,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "csv"
version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
dependencies = [
"bstr",
"csv-core",
"itoa 0.4.8",
"ryu",
"serde",
]
[[package]]
name = "csv-core"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
dependencies = [
"memchr",
]
[[package]]
name = "ctor"
version = "0.1.23"
@ -808,7 +774,6 @@ dependencies = [
"clap",
"clap_complete",
"clap_complete_fig",
"csv",
"data-url",
"deno_ast",
"deno_bench_util",
@ -844,7 +809,6 @@ dependencies = [
"flate2",
"fwdansi",
"glibc_version",
"google-storage1",
"http",
"import_map",
"indexmap",
@ -852,7 +816,7 @@ dependencies = [
"jsonc-parser",
"junction",
"libc",
"log 0.4.17",
"log",
"mitata",
"monch",
"napi_sym",
@ -860,7 +824,7 @@ dependencies = [
"notify",
"once_cell",
"os_pipe",
"percent-encoding 2.2.0",
"percent-encoding",
"pin-project",
"pretty_assertions",
"rand",
@ -921,7 +885,7 @@ dependencies = [
"swc_ecma_utils",
"swc_ecma_visit",
"text_lines",
"url 2.3.1",
"url",
]
[[package]]
@ -974,7 +938,7 @@ dependencies = [
"futures",
"indexmap",
"libc",
"log 0.4.17",
"log",
"once_cell",
"parking_lot 0.12.1",
"pin-project",
@ -983,7 +947,7 @@ dependencies = [
"serde_v8",
"sourcemap",
"tokio",
"url 2.3.1",
"url",
"v8",
]
@ -1093,10 +1057,10 @@ dependencies = [
"http",
"httparse",
"libc",
"log 0.4.17",
"log",
"mio",
"rustls",
"rustls-pemfile 1.0.1",
"rustls-pemfile",
"serde",
"socket2",
"tokio",
@ -1121,7 +1085,7 @@ dependencies = [
"serde_json",
"sourcemap",
"termcolor",
"url 2.3.1",
"url",
]
[[package]]
@ -1139,8 +1103,8 @@ dependencies = [
"flate2",
"fly-accept-encoding",
"hyper",
"mime 0.3.16",
"percent-encoding 2.2.0",
"mime",
"percent-encoding",
"phf",
"ring",
"serde",
@ -1158,7 +1122,7 @@ dependencies = [
"deno_ast",
"derive_more",
"if_chain",
"log 0.4.17",
"log",
"once_cell",
"regex",
"serde",
@ -1179,7 +1143,7 @@ version = "0.64.0"
dependencies = [
"deno_core",
"deno_tls",
"log 0.4.17",
"log",
"serde",
"socket2",
"tokio",
@ -1244,7 +1208,7 @@ dependencies = [
"http",
"hyper",
"libc",
"log 0.4.17",
"log",
"lzzzz",
"netif",
"nix",
@ -1285,7 +1249,7 @@ dependencies = [
"once_cell",
"rustls",
"rustls-native-certs",
"rustls-pemfile 1.0.1",
"rustls-pemfile",
"serde",
"webpki",
"webpki-roots",
@ -1649,7 +1613,7 @@ checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
"humantime",
"log 0.4.17",
"log",
"regex",
"termcolor",
]
@ -1712,7 +1676,7 @@ dependencies = [
"sha2",
"thiserror",
"tokio",
"url 2.3.1",
"url",
]
[[package]]
@ -1844,7 +1808,7 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
dependencies = [
"percent-encoding 2.2.0",
"percent-encoding",
]
[[package]]
@ -2075,23 +2039,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "google-storage1"
version = "3.1.0+20220228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "838c83adf6e1f0e35fa17b343e32762867f8ee8ea1a63e97c5ef5efda751bab9"
dependencies = [
"hyper",
"hyper-rustls",
"itertools",
"mime 0.2.6",
"serde",
"serde_derive",
"serde_json",
"url 1.7.2",
"yup-oauth2",
]
[[package]]
name = "gpu-alloc"
version = "0.5.3"
@ -2237,7 +2184,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
dependencies = [
"bytes",
"fnv",
"itoa 1.0.3",
"itoa",
]
[[package]]
@ -2284,7 +2231,7 @@ dependencies = [
"http-body",
"httparse",
"httpdate",
"itoa 1.0.3",
"itoa",
"pin-project-lite",
"socket2",
"tokio",
@ -2301,9 +2248,7 @@ checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac"
dependencies = [
"http",
"hyper",
"log 0.4.17",
"rustls",
"rustls-native-certs",
"tokio",
"tokio-rustls",
]
@ -2328,17 +2273,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "idna"
version = "0.2.3"
@ -2373,10 +2307,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b827962ca5aa6d5bbe313c14e73d7cc517487fa3bad380bb6bdbd8421e591a29"
dependencies = [
"indexmap",
"log 0.4.17",
"log",
"serde",
"serde_json",
"url 2.3.1",
"url",
]
[[package]]
@ -2492,12 +2426,6 @@ dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "itoa"
version = "1.0.3"
@ -2738,15 +2666,6 @@ dependencies = [
"scopeguard",
]
[[package]]
name = "log"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
dependencies = [
"log 0.4.17",
]
[[package]]
name = "log"
version = "0.4.17"
@ -2776,7 +2695,7 @@ dependencies = [
"serde",
"serde_json",
"serde_repr",
"url 2.3.1",
"url",
]
[[package]]
@ -2843,19 +2762,10 @@ dependencies = [
"block",
"core-graphics-types",
"foreign-types",
"log 0.4.17",
"log",
"objc",
]
[[package]]
name = "mime"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
dependencies = [
"log 0.3.9",
]
[[package]]
name = "mime"
version = "0.3.16"
@ -2878,7 +2788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [
"libc",
"log 0.4.17",
"log",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
]
@ -2909,7 +2819,7 @@ dependencies = [
"codespan-reporting",
"hexf-parse",
"indexmap",
"log 0.4.17",
"log",
"num-traits",
"rustc-hash",
"serde",
@ -3253,12 +3163,6 @@ dependencies = [
"base64ct",
]
[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]]
name = "percent-encoding"
version = "2.2.0"
@ -3625,12 +3529,6 @@ dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
[[package]]
name = "regex-syntax"
version = "0.6.27"
@ -3678,12 +3576,12 @@ dependencies = [
"ipnet",
"js-sys",
"lazy_static",
"log 0.4.17",
"mime 0.3.16",
"percent-encoding 2.2.0",
"log",
"mime",
"percent-encoding",
"pin-project-lite",
"rustls",
"rustls-pemfile 1.0.1",
"rustls-pemfile",
"serde",
"serde_json",
"serde_urlencoded",
@ -3692,7 +3590,7 @@ dependencies = [
"tokio-socks",
"tokio-util",
"tower-service",
"url 2.3.1",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
@ -3831,7 +3729,7 @@ version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033"
dependencies = [
"log 0.4.17",
"log",
"ring",
"sct",
"webpki",
@ -3844,20 +3742,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [
"openssl-probe",
"rustls-pemfile 1.0.1",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360"
dependencies = [
"base64",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.1"
@ -3878,7 +3767,7 @@ dependencies = [
"clipboard-win",
"fd-lock",
"libc",
"log 0.4.17",
"log",
"memchr",
"nix",
"radix_trie",
@ -3947,12 +3836,6 @@ dependencies = [
"untrusted",
]
[[package]]
name = "seahash"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "sec1"
version = "0.3.0"
@ -4047,7 +3930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
dependencies = [
"indexmap",
"itoa 1.0.3",
"itoa",
"ryu",
"serde",
]
@ -4070,7 +3953,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa 1.0.3",
"itoa",
"ryu",
"serde",
]
@ -4211,7 +4094,7 @@ dependencies = [
"rustc_version 0.2.3",
"serde",
"serde_json",
"url 2.3.1",
"url",
]
[[package]]
@ -4373,7 +4256,7 @@ dependencies = [
"swc_visit",
"tracing",
"unicode-width",
"url 2.3.1",
"url",
]
[[package]]
@ -4860,7 +4743,7 @@ dependencies = [
"regex",
"reqwest",
"ring",
"rustls-pemfile 1.0.1",
"rustls-pemfile",
"semver 1.0.14",
"serde",
"serde_json",
@ -4920,7 +4803,6 @@ checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
dependencies = [
"libc",
"num_threads",
"serde",
]
[[package]]
@ -5011,7 +4893,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e80b39df6afcc12cdf752398ade96a6b9e99c903dfdc36e53ad10b9c366bca72"
dependencies = [
"futures-util",
"log 0.4.17",
"log",
"rustls",
"tokio",
"tokio-rustls",
@ -5075,7 +4957,7 @@ dependencies = [
"dashmap",
"futures",
"httparse",
"log 0.4.17",
"log",
"lsp-types",
"memchr",
"serde",
@ -5178,7 +5060,7 @@ dependencies = [
"tinyvec",
"tokio",
"tracing",
"url 2.3.1",
"url",
]
[[package]]
@ -5256,12 +5138,12 @@ dependencies = [
"bytes",
"http",
"httparse",
"log 0.4.17",
"log",
"rand",
"rustls",
"sha-1 0.9.8",
"thiserror",
"url 2.3.1",
"url",
"utf-8",
"webpki",
]
@ -5415,17 +5297,6 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
dependencies = [
"idna 0.1.5",
"matches",
"percent-encoding 1.0.1",
]
[[package]]
name = "url"
version = "2.3.1"
@ -5434,7 +5305,7 @@ checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
dependencies = [
"form_urlencoded",
"idna 0.3.0",
"percent-encoding 2.2.0",
"percent-encoding",
"serde",
]
@ -5448,7 +5319,7 @@ dependencies = [
"regex",
"serde",
"unic-ucd-ident",
"url 2.3.1",
"url",
]
[[package]]
@ -5521,7 +5392,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
dependencies = [
"log 0.4.17",
"log",
"try-lock",
]
@ -5554,7 +5425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
dependencies = [
"bumpalo",
"log 0.4.17",
"log",
"once_cell",
"proc-macro2 1.0.43",
"quote 1.0.21",
@ -5645,7 +5516,7 @@ dependencies = [
"codespan-reporting",
"copyless",
"fxhash",
"log 0.4.17",
"log",
"naga",
"parking_lot 0.12.1",
"profiling",
@ -5681,7 +5552,7 @@ dependencies = [
"js-sys",
"khronos-egl",
"libloading",
"log 0.4.17",
"log",
"metal",
"naga",
"objc",
@ -5864,32 +5735,6 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]]
name = "yup-oauth2"
version = "6.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22978c3967bbb8ba0c100106d83e652cf640b55d64b7e7d93d943fc0738d9453"
dependencies = [
"anyhow",
"async-trait",
"base64",
"futures",
"http",
"hyper",
"hyper-rustls",
"itertools",
"log 0.4.17",
"percent-encoding 2.2.0",
"rustls",
"rustls-pemfile 0.3.0",
"seahash",
"serde",
"serde_json",
"time",
"tokio",
"url 2.3.1",
]
[[package]]
name = "zeroize"
version = "1.5.7"

View file

@ -119,11 +119,9 @@ junction = "=0.2.0"
winapi = { version = "=0.3.9", features = ["knownfolders", "mswsock", "objbase", "shlobj", "tlhelp32", "winbase", "winerror", "winsock2"] }
[dev-dependencies]
csv = "=1.1.6"
deno_bench_util = { version = "0.66.0", path = "../bench_util" }
dotenv = "=0.15.0"
flaky_test = "=0.1.0"
google-storage1 = "=3.1.0"
once_cell = "=1.14.0"
os_pipe = "=1.0.1"
pretty_assertions = "=1.3.0"

View file

@ -15,7 +15,6 @@ use std::time::SystemTime;
mod http;
mod lsp;
mod metrics;
fn read_json(filename: &str) -> Result<Value> {
let f = fs::File::open(filename)?;
@ -452,37 +451,28 @@ async fn main() -> Result<()> {
..Default::default()
};
let mut reporter = metrics::Reporter::new().await;
if benchmarks.contains(&"bundle") {
let bundle_size = bundle_benchmark(&deno_exe)?;
reporter.write("bundle_size", &bundle_size);
new_data.bundle_size = bundle_size;
}
if benchmarks.contains(&"exec_time") {
let exec_times = run_exec_time(&deno_exe, &target_dir)?;
for (name, data) in exec_times.iter() {
reporter.write_one("exec_time", name, *data.get("mean").unwrap());
}
new_data.benchmark = exec_times;
}
if benchmarks.contains(&"binary_size") {
let binary_sizes = get_binary_sizes(&target_dir)?;
reporter.write("binary_size", &binary_sizes);
new_data.binary_size = binary_sizes;
}
if benchmarks.contains(&"cargo_deps") {
let cargo_deps = cargo_deps();
reporter.write_one("cargo_deps", "cargo_deps", cargo_deps as i64);
new_data.cargo_deps = cargo_deps;
}
if benchmarks.contains(&"lsp") {
let lsp_exec_times = lsp::benchmarks(&deno_exe)?;
reporter.write("lsp_exec_time", &lsp_exec_times);
new_data.lsp_exec_time = lsp_exec_times;
}
@ -492,14 +482,12 @@ async fn main() -> Result<()> {
.iter()
.map(|(name, result)| (name.clone(), result.requests as i64))
.collect();
reporter.write("req_per_sec", &req_per_sec);
new_data.req_per_sec = req_per_sec;
let max_latency = stats
.iter()
.map(|(name, result)| (name.clone(), result.latency))
.collect();
reporter.write("max_latency", &max_latency);
new_data.max_latency = max_latency;
}
@ -538,19 +526,15 @@ async fn main() -> Result<()> {
syscall_count.insert(name.to_string(), total as i64);
}
reporter.write("thread_count", &thread_count);
new_data.thread_count = thread_count;
reporter.write("syscall_count", &syscall_count);
new_data.syscall_count = syscall_count;
}
if benchmarks.contains(&"mem_usage") {
let max_memory = run_max_mem_benchmark(&deno_exe)?;
reporter.write("max_memory", &max_memory);
new_data.max_memory = max_memory;
}
reporter.submit().await;
if let Some(filename) = target_dir.join("bench.json").to_str() {
write_json(filename, &serde_json::to_value(&new_data)?)?;
} else {

View file

@ -1,108 +0,0 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use google_storage1::api::Object;
use google_storage1::hyper;
use google_storage1::hyper_rustls;
use google_storage1::oauth2;
use google_storage1::Storage;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::io::Cursor;
static GIT_HASH: Lazy<String> = Lazy::new(|| {
test_util::run_collect(&["git", "rev-parse", "HEAD"], None, None, None, true)
.0
.trim()
.to_string()
});
#[derive(serde::Serialize)]
struct Metric<T: serde::Serialize> {
name: String,
value: T,
sha1: String,
#[serde(rename = "type")]
type_: String,
time: i64,
}
pub struct Reporter {
wtr: csv::Writer<Vec<u8>>,
gcloud_client: Option<Storage>,
}
impl Reporter {
pub async fn new() -> Self {
dotenv::dotenv().ok();
let gcloud_client =
match std::env::var("CI").map(|_| std::env::var("GOOGLE_SVC_KEY")) {
Ok(Ok(key_str)) => {
let secret = oauth2::parse_service_account_key(key_str)
.expect("Failed to load service account key");
let auth =
oauth2::authenticator::ServiceAccountAuthenticator::builder(secret)
.build()
.await
.unwrap();
let client = hyper::Client::builder().build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.https_or_http()
.enable_http1()
.enable_http2()
.build(),
);
Some(Storage::new(client, auth))
}
_ => None,
};
Self {
wtr: csv::Writer::from_writer(vec![]),
gcloud_client,
}
}
pub fn write_one<T: serde::Serialize>(
&mut self,
type_: &str,
name: &str,
value: T,
) {
self
.wtr
.serialize(Metric {
name: name.to_string(),
type_: type_.to_string(),
value,
sha1: GIT_HASH.clone(),
time: chrono::Utc::now().timestamp_millis(),
})
.unwrap();
}
pub fn write<T: serde::Serialize + Copy>(
&mut self,
type_: &str,
hashmap: &HashMap<String, T>,
) {
for (name, value) in hashmap {
self.write_one(type_, name, *value);
}
}
pub async fn submit(mut self) {
self.wtr.flush().unwrap();
if let Some(client) = self.gcloud_client.take() {
let mut reader = Cursor::new(self.wtr.into_inner().unwrap());
let object: Object = Object::default();
client
.objects()
.insert(object, "deno_benchmark_data")
.name(&format!("{}.csv", *GIT_HASH))
.param("uploadType", "multipart")
.upload(&mut reader, "text/csv".parse().unwrap())
.await
.unwrap();
}
}
}