summaryrefslogtreecommitdiff
path: root/webapp
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-09-04 20:04:57 -0400
committerKjetil Orbekk <kj@orbekk.com>2022-09-04 20:04:57 -0400
commitb66a92fcc6120781ad5bad06c29f57fa2c919a2c (patch)
tree8d835317ef4b65bef4db9aaf153f5b29a35d0b04 /webapp
parentab68d26c6b16f973642d378900f5e6ac2be221b7 (diff)
Add some release size optimizations
Diffstat (limited to 'webapp')
-rw-r--r--webapp/Cargo.toml13
-rw-r--r--webapp/src/main.rs5
2 files changed, 18 insertions, 0 deletions
diff --git a/webapp/Cargo.toml b/webapp/Cargo.toml
index 15a880a..1a52093 100644
--- a/webapp/Cargo.toml
+++ b/webapp/Cargo.toml
@@ -12,7 +12,20 @@ strum = "0.24"
strum_macros = "0.24"
rand = "0.8.4"
getrandom = { version = "0.2.7", features = ["js"] }
+wee_alloc = "0.4.3"
[dev-dependencies]
env_logger = "0.8.4"
dotenv = "0.15"
+
+[profile.release]
+# less code to include into binary
+panic = 'abort'
+# optimization over all codebase ( better optimization, slower build )
+codegen-units = 1
+# optimization for size ( more aggressive )
+opt-level = 'z'
+# optimization for size
+# opt-level = 's'
+# link time optimization using using whole-program analysis
+lto = true
diff --git a/webapp/src/main.rs b/webapp/src/main.rs
index 633f560..7f22b0f 100644
--- a/webapp/src/main.rs
+++ b/webapp/src/main.rs
@@ -4,6 +4,11 @@ use log::{debug, error, info, warn};
use yew::prelude::*;
pub mod card;
pub mod bridge_engine;
+extern crate wee_alloc;
+
+// Use `wee_alloc` as the global allocator.
+#[global_allocator]
+static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
fn main() {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));