Skip to content

Commit

Permalink
fix(es/codegen): Improve performance of debug build (#6003)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Sep 30, 2022
1 parent 3204ac3 commit 8b31b65
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,4 @@ opt-level = 3
opt-level = 3

[workspace.dependencies]
serde = "1.0.145"
swc_core = { version = "0.28.10", path = "./crates/swc_core" }
swc_common = { version = "0.29.3", path = "./crates/swc_common" }
serde = "1.0.145"
2 changes: 1 addition & 1 deletion crates/swc_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ swc = { optional = true, version = "0.230.9", path
swc_atoms = { optional = true, version = "0.4.18", path = "../swc_atoms" }
swc_bundler = { optional = true, version = "0.190.21", path = "../swc_bundler" }
swc_cached = { optional = true, version = "0.3.14", path = "../swc_cached" }
swc_common = { optional = true, workspace = true, path = "../swc_common" }
swc_common = { optional = true, version = "0.29.3", path = "../swc_common" }
swc_css_ast = { optional = true, version = "0.114.4", path = "../swc_css_ast" }
swc_css_codegen = { optional = true, version = "0.124.4", path = "../swc_css_codegen" }
swc_css_minifier = { optional = true, version = "0.89.5", path = "../swc_css_minifier" }
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_ecma_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ scoped-tls = "1.0.0"
serde = { workspace = true, features = ["derive"] }
string_enum = { version = "0.3.1", path = "../string_enum" }
swc_atoms = { version = "0.4.18", path = "../swc_atoms" }
swc_common = { workspace = true, path = "../swc_common" }
swc_common = { version = "0.29.3", path = "../swc_common" }
unicode-id = "0.3"

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions crates/swc_ecma_codegen/src/text_writer/basic_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ impl<'a, W: Write> JsWriter<'a, W> {

#[inline]
fn raw_write(&mut self, data: &str) -> Result {
#[cfg(debug_assertions)]
tracing::trace!("Write: `{}`", data);
// #[cfg(debug_assertions)]
// tracing::trace!("Write: `{}`", data);

self.wr.write_all(data.as_bytes())?;
if self.srcmap.is_some() {
Expand Down Expand Up @@ -111,8 +111,8 @@ impl<'a, W: Write> JsWriter<'a, W> {
col: self.line_pos as _,
};

#[cfg(debug_assertions)]
tracing::trace!("SourceMap: {:?} => {:?}", byte_pos, loc);
// #[cfg(debug_assertions)]
// tracing::trace!("SourceMap: {:?} => {:?}", byte_pos, loc);

srcmap.push((byte_pos, loc));
}
Expand Down

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

37 changes: 19 additions & 18 deletions crates/swc_plugin_runner/tests/fixture/swc_noop_plugin/Cargo.lock

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

1 comment on commit 8b31b65

@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: 8b31b65 Previous: 3204ac3 Ratio
es/full/minify/libraries/antd 2026447602 ns/iter (± 356211333) 2057783354 ns/iter (± 243136074) 0.98
es/full/minify/libraries/d3 377479583 ns/iter (± 19921307) 408914609 ns/iter (± 9713812) 0.92
es/full/minify/libraries/echarts 1715517573 ns/iter (± 303997484) 1552820286 ns/iter (± 94093847) 1.10
es/full/minify/libraries/jquery 98401134 ns/iter (± 8146377) 104476925 ns/iter (± 2806250) 0.94
es/full/minify/libraries/lodash 121338558 ns/iter (± 20688649) 137074395 ns/iter (± 11769114) 0.89
es/full/minify/libraries/moment 54429590 ns/iter (± 10277132) 59680325 ns/iter (± 16913358) 0.91
es/full/minify/libraries/react 19298424 ns/iter (± 653478) 21567911 ns/iter (± 2715105) 0.89
es/full/minify/libraries/terser 286197649 ns/iter (± 19026440) 312783637 ns/iter (± 11325746) 0.92
es/full/minify/libraries/three 491032586 ns/iter (± 13254297) 528431380 ns/iter (± 22855660) 0.93
es/full/minify/libraries/typescript 3174311284 ns/iter (± 110222367) 3756454877 ns/iter (± 916088250) 0.85
es/full/minify/libraries/victory 759774652 ns/iter (± 37931877) 816537797 ns/iter (± 39389783) 0.93
es/full/minify/libraries/vue 134515992 ns/iter (± 15952631) 159569726 ns/iter (± 8708146) 0.84
es/full/codegen/es3 34341 ns/iter (± 1083) 35823 ns/iter (± 6779) 0.96
es/full/codegen/es5 34158 ns/iter (± 527) 35978 ns/iter (± 5095) 0.95
es/full/codegen/es2015 34199 ns/iter (± 492) 36433 ns/iter (± 2568) 0.94
es/full/codegen/es2016 33978 ns/iter (± 844) 36977 ns/iter (± 4521) 0.92
es/full/codegen/es2017 34068 ns/iter (± 905) 36100 ns/iter (± 3316) 0.94
es/full/codegen/es2018 34083 ns/iter (± 749) 36829 ns/iter (± 5226) 0.93
es/full/codegen/es2019 34037 ns/iter (± 1018) 36118 ns/iter (± 2073) 0.94
es/full/codegen/es2020 34056 ns/iter (± 351) 35271 ns/iter (± 2473) 0.97
es/full/all/es3 195067694 ns/iter (± 14107401) 204411064 ns/iter (± 21642469) 0.95
es/full/all/es5 181764215 ns/iter (± 11232032) 194402746 ns/iter (± 18055498) 0.93
es/full/all/es2015 148609703 ns/iter (± 8009571) 155036158 ns/iter (± 13238826) 0.96
es/full/all/es2016 148536065 ns/iter (± 13989531) 154037657 ns/iter (± 15720818) 0.96
es/full/all/es2017 147969328 ns/iter (± 6809749) 149872298 ns/iter (± 10230497) 0.99
es/full/all/es2018 150337807 ns/iter (± 13674618) 145995680 ns/iter (± 20030750) 1.03
es/full/all/es2019 148788292 ns/iter (± 11584815) 148188824 ns/iter (± 8062048) 1.00
es/full/all/es2020 145234421 ns/iter (± 9844624) 150169358 ns/iter (± 14968996) 0.97
es/full/parser 725552 ns/iter (± 39289) 790642 ns/iter (± 98549) 0.92
es/full/base/fixer 26814 ns/iter (± 1391) 28355 ns/iter (± 3907) 0.95
es/full/base/resolver_and_hygiene 95030 ns/iter (± 6197) 104620 ns/iter (± 19649) 0.91
serialization of ast node 216 ns/iter (± 20) 462 ns/iter (± 34) 0.47
serialization of serde 220 ns/iter (± 15) 466 ns/iter (± 40) 0.47

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

Please sign in to comment.