-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into lf94/tauri-to-electron
- Loading branch information
Showing
13 changed files
with
2,421 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; | ||
use kcl_lib::test_server; | ||
use tokio::runtime::Runtime; | ||
|
||
pub fn bench_execute(c: &mut Criterion) { | ||
for (name, code) in [ | ||
("big_kitt", KITT_PROGRAM), | ||
("cube", CUBE_PROGRAM), | ||
("server_rack_heavy", SERVER_RACK_HEAVY_PROGRAM), | ||
] { | ||
let mut group = c.benchmark_group("executor"); | ||
// Configure Criterion.rs to detect smaller differences and increase sample size to improve | ||
// precision and counteract the resulting noise. | ||
group.sample_size(10); | ||
group.bench_with_input(BenchmarkId::new("execute_", name), &code, |b, &s| { | ||
let rt = Runtime::new().unwrap(); | ||
|
||
// Spawn a future onto the runtime | ||
b.iter(|| { | ||
rt.block_on(test_server::execute_and_snapshot( | ||
s, | ||
kcl_lib::settings::types::UnitLength::Mm, | ||
)) | ||
.unwrap(); | ||
}); | ||
}); | ||
group.finish(); | ||
} | ||
} | ||
|
||
criterion_group!(benches, bench_execute); | ||
criterion_main!(benches); | ||
|
||
const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl"); | ||
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl"); | ||
const SERVER_RACK_HEAVY_PROGRAM: &str = include_str!("../../tests/executor/inputs/server-rack-heavy.kcl"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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::settings::types::UnitLength::Mm) | ||
.await | ||
.unwrap(), | ||
); | ||
} | ||
|
||
iai::main! { | ||
execute_server_rack_heavy, | ||
} | ||
|
||
const SERVER_RACK_HEAVY_PROGRAM: &str = include_str!("../../tests/executor/inputs/server-rack-heavy.kcl"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.