Skip to content

Commit

Permalink
feat(css/plugin): Prepare Wasm plugins (#6567)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Dec 2, 2022
1 parent ab2e19b commit 8cdc28c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Expand Up @@ -660,7 +660,7 @@ jobs:
- name: Run cargo test (plugin)
if: matrix.settings.crate == 'swc_plugin_runner'
run: |
cargo test -p swc_plugin_runner --release --features plugin_transform_schema_v1 --features rkyv-impl
cargo test -p swc_plugin_runner --release --features plugin_transform_schema_v1 --features rkyv-impl --features ecma --features css
- name: Run cargo test (swc_ecma_minifier)
if: matrix.settings.crate == 'swc_ecma_minifier'
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion crates/swc/Cargo.toml
Expand Up @@ -28,7 +28,11 @@ debug = ["swc_ecma_visit/debug"]
default = ["es3"]
es3 = []
node = ["napi", "napi-derive"]
plugin = ["swc_plugin_runner/rkyv-impl", "swc_plugin_proxy/plugin-rt"]
plugin = [
"swc_plugin_runner/ecma",
"swc_plugin_runner/rkyv-impl",
"swc_plugin_proxy/plugin-rt",
]
plugin-bytecheck = [
"swc_plugin_runner/rkyv-bytecheck-impl",
"swc_plugin_proxy/plugin-bytecheck-rt",
Expand Down
30 changes: 16 additions & 14 deletions crates/swc_plugin_runner/Cargo.toml
Expand Up @@ -22,19 +22,18 @@ memory_cache = []
plugin_transform_schema_v1 = ["swc_common/plugin_transform_schema_v1"]
plugin_transform_schema_vtest = ["swc_common/plugin_transform_schema_vtest"]

# Enable ECMASCript support
ecma = ["swc_ecma_ast/rkyv-impl"]
# Enable CSS support
css = ["swc_css_ast/rkyv-impl"]

__rkyv = []
rkyv-bytecheck-impl = [
"__rkyv",
"swc_common/plugin-bytecheck-rt",
"swc_plugin_proxy/plugin-bytecheck-rt",
"swc_ecma_ast/rkyv-bytecheck-impl",
]
rkyv-impl = [
"__rkyv",
"swc_common/plugin-rt",
"swc_plugin_proxy/plugin-rt",
"swc_ecma_ast/rkyv-impl",
]
rkyv-impl = ["__rkyv", "swc_common/plugin-rt", "swc_plugin_proxy/plugin-rt"]

[dependencies]
anyhow = "1.0.42"
Expand All @@ -46,11 +45,11 @@ serde_json = "1.0.64"
swc_common = { version = "0.29.17", path = "../swc_common", features = [
"concurrent",
] }
swc_ecma_ast = { version = "0.95.1", path = "../swc_ecma_ast" }
swc_plugin_proxy = { version = "0.23.1", path = "../swc_plugin_proxy" }

tracing = "0.1.32"
wasmer = { version = "2.3.0", default-features = false }
swc_css_ast = { version = "0.128.1", path = "../swc_css_ast", optional = true }
swc_ecma_ast = { version = "0.95.1", path = "../swc_ecma_ast", optional = true }
swc_plugin_proxy = { version = "0.23.0", path = "../swc_plugin_proxy" }
tracing = "0.1.32"
wasmer = { version = "2.3.0", default-features = false }
wasmer-wasi = { version = "2.3.0", default-features = false }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand All @@ -67,9 +66,12 @@ swc_ecma_visit = { version = "0.81.1", path = "../swc_ecma_visit" }
swc_node_base = { version = "0.5.8", path = "../swc_node_base" }
testing = { version = "0.31.18", path = "../testing" }
# This allows we can run non-wasm32 target build command while some pkg select features for wasmer/js omits its transitive deps
wasmer = "2.3.0"
swc_ecma_ast = { version = "0.95.1", path = "../swc_ecma_ast", feature = [
"rkyv-impl",
] }
wasmer = "2.3.0"
wasmer-wasi = "2.3.0"

[[bench]]
harness = false
name = "invoke"
name = "ecma_invoke"
File renamed without changes.
File renamed without changes.

1 comment on commit 8cdc28c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8cdc28c Previous: 4af52c7 Ratio
es/full/bugs-1 358089 ns/iter (± 76574) 336470 ns/iter (± 26017) 1.06
es/full/minify/libraries/antd 2276050437 ns/iter (± 26620525) 1977533977 ns/iter (± 22733268) 1.15
es/full/minify/libraries/d3 508166180 ns/iter (± 21506236) 440415931 ns/iter (± 18969435) 1.15
es/full/minify/libraries/echarts 1903803414 ns/iter (± 55789374) 1727554504 ns/iter (± 44917915) 1.10
es/full/minify/libraries/jquery 133132505 ns/iter (± 9621702) 111171313 ns/iter (± 2980819) 1.20
es/full/minify/libraries/lodash 155105922 ns/iter (± 9825492) 140959178 ns/iter (± 2959741) 1.10
es/full/minify/libraries/moment 74941028 ns/iter (± 2207589) 70889602 ns/iter (± 1540179) 1.06
es/full/minify/libraries/react 24320886 ns/iter (± 939304) 22869963 ns/iter (± 546241) 1.06
es/full/minify/libraries/terser 396720397 ns/iter (± 7228508) 336309217 ns/iter (± 21053548) 1.18
es/full/minify/libraries/three 696597179 ns/iter (± 20296114) 616913334 ns/iter (± 8726645) 1.13
es/full/minify/libraries/typescript 4131786600 ns/iter (± 84194408) 3668020802 ns/iter (± 29183046) 1.13
es/full/minify/libraries/victory 999228771 ns/iter (± 34553774) 903282720 ns/iter (± 21075307) 1.11
es/full/minify/libraries/vue 198179218 ns/iter (± 7050970) 168089590 ns/iter (± 8536610) 1.18
es/full/codegen/es3 36583 ns/iter (± 3662) 33481 ns/iter (± 579) 1.09
es/full/codegen/es5 34833 ns/iter (± 1741) 33410 ns/iter (± 526) 1.04
es/full/codegen/es2015 33796 ns/iter (± 2025) 33423 ns/iter (± 463) 1.01
es/full/codegen/es2016 34111 ns/iter (± 1452) 33390 ns/iter (± 977) 1.02
es/full/codegen/es2017 33793 ns/iter (± 2914) 32839 ns/iter (± 1105) 1.03
es/full/codegen/es2018 33757 ns/iter (± 993) 33307 ns/iter (± 1154) 1.01
es/full/codegen/es2019 33634 ns/iter (± 2286) 33400 ns/iter (± 511) 1.01
es/full/codegen/es2020 33719 ns/iter (± 1219) 33420 ns/iter (± 342) 1.01
es/full/all/es3 195636704 ns/iter (± 5400805) 188046506 ns/iter (± 8881474) 1.04
es/full/all/es5 185522466 ns/iter (± 5742440) 179533046 ns/iter (± 8181022) 1.03
es/full/all/es2015 148209196 ns/iter (± 5570362) 144321531 ns/iter (± 8234440) 1.03
es/full/all/es2016 152713049 ns/iter (± 9353884) 143821601 ns/iter (± 20042934) 1.06
es/full/all/es2017 151192116 ns/iter (± 8752166) 141150194 ns/iter (± 4526075) 1.07
es/full/all/es2018 150219541 ns/iter (± 9058792) 139321767 ns/iter (± 9122253) 1.08
es/full/all/es2019 145006616 ns/iter (± 7534774) 150396187 ns/iter (± 10414466) 0.96
es/full/all/es2020 140259464 ns/iter (± 10692626) 145464943 ns/iter (± 13307571) 0.96
es/full/parser 733676 ns/iter (± 74048) 708816 ns/iter (± 41381) 1.04
es/full/base/fixer 26974 ns/iter (± 1913) 25966 ns/iter (± 935) 1.04
es/full/base/resolver_and_hygiene 95821 ns/iter (± 4365) 91685 ns/iter (± 3209) 1.05
serialization of ast node 219 ns/iter (± 24) 209 ns/iter (± 5) 1.05
serialization of serde 228 ns/iter (± 22) 218 ns/iter (± 10) 1.05

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.