From c5dea20e1dad2bb3efc0f62b7beb15ac39930843 Mon Sep 17 00:00:00 2001 From: Boshen Date: Mon, 6 Mar 2023 14:50:02 +0800 Subject: [PATCH] fix(oxc_wasm): remove wee_alloc dependency; fix profile warning --- Cargo.lock | 51 ++++++++---------------------- Cargo.toml | 1 + crates/oxc_wasm/.cargo/config.toml | 2 ++ crates/oxc_wasm/Cargo.toml | 11 ------- crates/oxc_wasm/README.md | 2 -- 5 files changed, 16 insertions(+), 51 deletions(-) create mode 100644 crates/oxc_wasm/.cargo/config.toml diff --git a/Cargo.lock b/Cargo.lock index 0c7636df5..318fc8fd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,12 +100,6 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -189,7 +183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff0805f79ecb1b35163f3957a6934ea8d04fcd36ef98b52e7316f63e72e73d1" dependencies = [ "castaway", - "cfg-if 1.0.0", + "cfg-if", "itoa", "ryu", "serde", @@ -215,7 +209,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen", ] @@ -234,7 +228,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -277,7 +271,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -287,7 +281,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -299,7 +293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "memoffset", "scopeguard", @@ -311,7 +305,7 @@ version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -332,7 +326,7 @@ version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -396,7 +390,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -629,7 +623,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -647,12 +641,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "miette" version = "5.5.0" @@ -943,7 +931,6 @@ dependencies = [ "serde_json", "wasm-bindgen", "wasm-bindgen-test", - "wee_alloc", ] [[package]] @@ -1286,7 +1273,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -1432,7 +1419,7 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "serde_json", "wasm-bindgen-macro", @@ -1459,7 +1446,7 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -1547,18 +1534,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 2b2b10f1f..4f0f0fb39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ indextree = "4.5.0" glob = "0.3.1" lazy_static = "1.4.0" + [profile.release] # Configurations explicitly listed here for clarity. # Using the best options for performance. diff --git a/crates/oxc_wasm/.cargo/config.toml b/crates/oxc_wasm/.cargo/config.toml new file mode 100644 index 000000000..e3787381f --- /dev/null +++ b/crates/oxc_wasm/.cargo/config.toml @@ -0,0 +1,2 @@ +[profile.release] +opt-level = "s" # Tell `rustc` to optimize for small code size. diff --git a/crates/oxc_wasm/Cargo.toml b/crates/oxc_wasm/Cargo.toml index d8d460bfb..0acb6e6cf 100644 --- a/crates/oxc_wasm/Cargo.toml +++ b/crates/oxc_wasm/Cargo.toml @@ -35,16 +35,5 @@ wasm-bindgen = {version = "0.2", features = ["serde-serialize"]} # code size when deploying. console_error_panic_hook = {version = "0.1.6", optional = true} -# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size -# compared to the default allocator's ~10K. It is slower than the default -# allocator, however. -# -# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now. -wee_alloc = {version = "0.4.5", optional = true} - [dev-dependencies] wasm-bindgen-test = "0.3.13" - -[profile.release] -# Tell `rustc` to optimize for small code size. -opt-level = "s" diff --git a/crates/oxc_wasm/README.md b/crates/oxc_wasm/README.md index 6927d35c7..d08d6205c 100644 --- a/crates/oxc_wasm/README.md +++ b/crates/oxc_wasm/README.md @@ -34,5 +34,3 @@ wasm-pack publish between WebAssembly and JavaScript. - [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) for logging panic messages to the developer console. -- [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized - for small code size.