Skip to content

Commit 43e6dca

Browse files
committed
tests wasmer and wasmtime
1 parent dc7eb23 commit 43e6dca

File tree

10 files changed

+484
-575
lines changed

10 files changed

+484
-575
lines changed

Cargo.lock

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/swc_plugin_backend_tests/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ bench = false
1313
doctest = false
1414

1515
[dev-dependencies]
16+
anyhow = { workspace = true }
1617
codspeed-criterion-compat = { workspace = true }
1718
rustc-hash = { workspace = true }
1819
serde = { workspace = true, features = ["derive"] }
1920
serde_json = { workspace = true }
2021
tokio = { workspace = true, features = ["rt"] }
2122
tracing = { workspace = true }
2223

24+
swc_common = { version = "14.0.2", path = "../swc_common", features = [
25+
"concurrent",
26+
] }
2327
swc_plugin_runner = { version = "17.0.0", path = "../swc_plugin_runner", features = ["rkyv-impl", "plugin_transform_schema_v1"] }
2428
swc_css_ast = { version = "14.0.0", path = "../swc_css_ast", features = [
2529
"rkyv-impl",

crates/swc_plugin_backend_tests/benches/ecma_invoke.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use swc_common::{
1717
};
1818
use swc_ecma_ast::EsVersion;
1919
use swc_ecma_parser::parse_file_as_program;
20-
use swc_plugin_backend_wasmer::WasmerRuntime;
2120
use swc_plugin_runner::runtime::Runtime;
2221

2322
static SOURCE: &str = include_str!("../../swc_ecma_minifier/benches/full/typescript.js");
@@ -40,12 +39,24 @@ fn plugin_group(c: &mut Criterion) {
4039
assert!(status.success());
4140
}
4241

43-
c.bench_function("es/plugin/invoke/1", |b| bench_transform(b, &plugin_dir));
42+
c.bench_function("es/plugin/invoke/1/wasmer", |b| {
43+
bench_transform(
44+
b,
45+
&plugin_dir,
46+
Arc::new(swc_plugin_backend_wasmer::WasmerRuntime),
47+
)
48+
});
49+
50+
c.bench_function("es/plugin/invoke/1/wasmtime", |b| {
51+
bench_transform(
52+
b,
53+
&plugin_dir,
54+
Arc::new(swc_plugin_backend_wasmtime::WasmtimeRuntime),
55+
)
56+
});
4457
}
4558

46-
fn bench_transform(b: &mut Bencher, plugin_dir: &Path) {
47-
let runtime = Arc::new(WasmerRuntime);
48-
59+
fn bench_transform(b: &mut Bencher, plugin_dir: &Path, runtime: Arc<dyn Runtime>) {
4960
let path = &plugin_dir
5061
.join("target")
5162
.join("wasm32-wasip1")

0 commit comments

Comments
 (0)