From ddf00122005819fbe6e5cf617f26ef857e2edd95 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Fri, 17 Jan 2025 13:24:57 -0600 Subject: [PATCH] Rust: Remove iai benchmark tests We don't get much value from these, we can always run criterion or valgrind locally. If we want to measure instruction counts, we should be using codspeed.io instead because they support visualizing and tracking over time. If we want to track performance over time we should be using Kevin's perf monitor machine. --- src/wasm-lib/Cargo.lock | 7 --- src/wasm-lib/kcl/Cargo.toml | 13 ------ .../kcl/benches/compiler_benchmark_iai.rs | 35 --------------- .../kcl/benches/executor_benchmark_iai.rs | 27 ----------- .../lsp_semantic_tokens_benchmark_iai.rs | 45 ------------------- 5 files changed, 127 deletions(-) delete mode 100644 src/wasm-lib/kcl/benches/compiler_benchmark_iai.rs delete mode 100644 src/wasm-lib/kcl/benches/executor_benchmark_iai.rs delete mode 100644 src/wasm-lib/kcl/benches/lsp_semantic_tokens_benchmark_iai.rs diff --git a/src/wasm-lib/Cargo.lock b/src/wasm-lib/Cargo.lock index 7327491155..acd0022bd9 100644 --- a/src/wasm-lib/Cargo.lock +++ b/src/wasm-lib/Cargo.lock @@ -1382,12 +1382,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iai" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a816c97c42258aa5834d07590b718b4c9a598944cd39a52dc25b351185d678" - [[package]] name = "iana-time-zone" version = "0.1.61" @@ -1739,7 +1733,6 @@ dependencies = [ "gltf-json", "handlebars", "http 1.2.0", - "iai", "image", "indexmap 2.7.0", "insta", diff --git a/src/wasm-lib/kcl/Cargo.toml b/src/wasm-lib/kcl/Cargo.toml index 04bfc5bcbd..85317cc592 100644 --- a/src/wasm-lib/kcl/Cargo.toml +++ b/src/wasm-lib/kcl/Cargo.toml @@ -113,7 +113,6 @@ base64 = "0.22.1" criterion = { version = "0.5.1", features = ["async_tokio"] } expectorate = "1.1.0" handlebars = "6.3.0" -iai = "0.1" image = { version = "0.25.5", default-features = false, features = ["png"] } insta = { version = "1.41.1", features = ["json", "filters", "redactions"] } itertools = "0.13.0" @@ -129,10 +128,6 @@ workspace = true name = "compiler_benchmark_criterion" harness = false -[[bench]] -name = "compiler_benchmark_iai" -harness = false - [[bench]] name = "digest_benchmark" harness = false @@ -142,15 +137,7 @@ name = "lsp_semantic_tokens_benchmark_criterion" harness = false required-features = ["lsp-test-util"] -[[bench]] -name = "lsp_semantic_tokens_benchmark_iai" -harness = false -required-features = ["lsp-test-util"] - [[bench]] name = "executor_benchmark_criterion" harness = false -[[bench]] -name = "executor_benchmark_iai" -harness = false diff --git a/src/wasm-lib/kcl/benches/compiler_benchmark_iai.rs b/src/wasm-lib/kcl/benches/compiler_benchmark_iai.rs deleted file mode 100644 index a57e321377..0000000000 --- a/src/wasm-lib/kcl/benches/compiler_benchmark_iai.rs +++ /dev/null @@ -1,35 +0,0 @@ -use iai::black_box; - -pub fn parse(program: &str) { - black_box(kcl_lib::Program::parse(program).unwrap()); -} - -fn parse_kitt() { - parse(KITT_PROGRAM) -} -fn parse_pipes() { - parse(PIPES_PROGRAM) -} -fn parse_cube() { - parse(CUBE_PROGRAM) -} -fn parse_math() { - parse(MATH_PROGRAM) -} -fn parse_lsystem() { - parse(LSYSTEM_PROGRAM) -} - -iai::main! { - parse_kitt, - parse_pipes, - parse_cube, - parse_math, - parse_lsystem, -} - -const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl"); -const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl"); -const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl"); -const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl"); -const LSYSTEM_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl"); diff --git a/src/wasm-lib/kcl/benches/executor_benchmark_iai.rs b/src/wasm-lib/kcl/benches/executor_benchmark_iai.rs deleted file mode 100644 index 5670dcde03..0000000000 --- a/src/wasm-lib/kcl/benches/executor_benchmark_iai.rs +++ /dev/null @@ -1,27 +0,0 @@ -use iai::black_box; - -async fn execute_server_rack_heavy() { - let code = SERVER_RACK_HEAVY_PROGRAM; - black_box( - kcl_lib::test_server::execute_and_snapshot(code, kcl_lib::UnitLength::Mm, None) - .await - .unwrap(), - ); -} - -async fn execute_server_rack_lite() { - let code = SERVER_RACK_LITE_PROGRAM; - black_box( - kcl_lib::test_server::execute_and_snapshot(code, kcl_lib::UnitLength::Mm, None) - .await - .unwrap(), - ); -} - -iai::main! { - execute_server_rack_lite, - execute_server_rack_heavy, -} - -const SERVER_RACK_HEAVY_PROGRAM: &str = include_str!("../../tests/executor/inputs/server-rack-heavy.kcl"); -const SERVER_RACK_LITE_PROGRAM: &str = include_str!("../../tests/executor/inputs/server-rack-lite.kcl"); diff --git a/src/wasm-lib/kcl/benches/lsp_semantic_tokens_benchmark_iai.rs b/src/wasm-lib/kcl/benches/lsp_semantic_tokens_benchmark_iai.rs deleted file mode 100644 index 5b71bda94e..0000000000 --- a/src/wasm-lib/kcl/benches/lsp_semantic_tokens_benchmark_iai.rs +++ /dev/null @@ -1,45 +0,0 @@ -use iai::black_box; -use kcl_lib::kcl_lsp_server; -use tower_lsp::LanguageServer; - -async fn kcl_lsp_semantic_tokens(code: &str) { - let server = kcl_lsp_server(false).await.unwrap(); - - // Send open file. - server - .did_open(tower_lsp::lsp_types::DidOpenTextDocumentParams { - text_document: tower_lsp::lsp_types::TextDocumentItem { - uri: "file:///test.kcl".try_into().unwrap(), - language_id: "kcl".to_string(), - version: 1, - text: code.to_string(), - }, - }) - .await; - - // Send semantic tokens request. - black_box( - server - .semantic_tokens_full(tower_lsp::lsp_types::SemanticTokensParams { - text_document: tower_lsp::lsp_types::TextDocumentIdentifier { - uri: "file:///test.kcl".try_into().unwrap(), - }, - partial_result_params: Default::default(), - work_done_progress_params: Default::default(), - }) - .await - .unwrap() - .unwrap(), - ); -} - -async fn semantic_tokens_global_tags() { - let code = GLOBAL_TAGS_FILE; - kcl_lsp_semantic_tokens(code).await; -} - -iai::main! { - semantic_tokens_global_tags, -} - -const GLOBAL_TAGS_FILE: &str = include_str!("../../tests/executor/inputs/global-tags.kcl");