chiark / gitweb /
wee_alloc saves quite a bit of binary size
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 Oct 2020 23:10:04 +0000 (00:10 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 Oct 2020 23:10:04 +0000 (00:10 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cargo.lock.example
wasm/Cargo.toml
wasm/wasm.rs

index 84b871d064ad668ab12930e78a5cf9b68cee897c..79fdb2feeb4719b796daa4eef577cdeab91fdfdc 100644 (file)
@@ -805,6 +805,12 @@ version = "2.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
 
+[[package]]
+name = "memory_units"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
+
 [[package]]
 name = "mime"
 version = "0.2.6"
@@ -1010,6 +1016,7 @@ dependencies = [
  "js-sys",
  "otter-zcoord",
  "wasm-bindgen",
+ "wee_alloc",
 ]
 
 [[package]]
@@ -1898,6 +1905,18 @@ version = "0.2.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
 
+[[package]]
+name = "wee_alloc"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "memory_units",
+ "winapi 0.3.9",
+]
+
 [[package]]
 name = "winapi"
 version = "0.2.8"
index 4a3555205720b40a70eda65454c5cfee2d2b7abf..58065953fd35d967bfa08bb8549ebebb233f17b7 100644 (file)
@@ -17,3 +17,5 @@ otter-zcoord = { path = "../zcoord" }
 wasm-bindgen = "0.2"
 js-sys = "0.3"
 fehler = "1"
+wee_alloc = "0.4"
+#wee_alloc = { version = "0.4.5", optional = true }
index b84d815cf2cd5503d5916e9fdee6e5e16fb67d4c..8d52583247f76bad053c477cc681b2d159c61d84 100644 (file)
@@ -56,3 +56,7 @@ pub fn canary(s: &str) -> JsString {
   //  https://github.com/WebAssembly/binaryen/issues/3006
   format!("WASM {}", s).into()
 }
+
+//#[cfg(feature = "wee_alloc")]
+#[global_allocator]
+static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;