Oz again
This commit is contained in:
parent
a16da53d13
commit
9aa4088731
@ -12,7 +12,7 @@ crate-type=["cdylib"]
|
|||||||
[profile.release]
|
[profile.release]
|
||||||
debug = false
|
debug = false
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
opt-level = "s" #optimize for size
|
opt-level = "z" #optimize for size
|
||||||
lto = true
|
lto = true
|
||||||
strip = true
|
strip = true
|
||||||
|
|
||||||
|
|||||||
8
build.sh
8
build.sh
@ -1,18 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -fr tmp pkg | true #delete tmp folder if exists
|
rm -fr tmp | true
|
||||||
|
rm -fr pkg | true
|
||||||
|
|
||||||
#apply optimizations via wasm-opt
|
#apply optimizations via wasm-opt
|
||||||
wasm_opt() {
|
wasm_opt() {
|
||||||
wasm-opt -Os -o pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
|
wasm-opt -Oz -o pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
|
||||||
mv pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
|
mv pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
|
||||||
}
|
}
|
||||||
|
|
||||||
if test "$1" == "" || test "$1" == "release"; then
|
if test "$1" == "" || test "$1" == "release"; then
|
||||||
wasm-pack build --target web --release --no-typescript
|
wasm-pack build --target web --release --no-typescript
|
||||||
|
echo "Binary size (pre-wasm_opt): $(du -sb pkg/integral_site_bg.wasm)"
|
||||||
wasm_opt #apply wasm optimizations
|
wasm_opt #apply wasm optimizations
|
||||||
|
echo "Binary size (pre-strip): $(du -sb pkg/integral_site_bg.wasm)"
|
||||||
llvm-strip --strip-all pkg/integral_site_bg.wasm
|
llvm-strip --strip-all pkg/integral_site_bg.wasm
|
||||||
elif test "$1" == "debug"; then
|
elif test "$1" == "debug"; then
|
||||||
wasm-pack build --target web --debug --no-typescript
|
wasm-pack build --target web --debug --no-typescript
|
||||||
|
|||||||
@ -38,6 +38,7 @@ pub struct Function {
|
|||||||
sum: RiemannSum,
|
sum: RiemannSum,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// x^2 function, set here so we don't have to regenerate it every time a new function is made
|
||||||
fn default_function(x: f64) -> f64 { x.powi(2) }
|
fn default_function(x: f64) -> f64 { x.powi(2) }
|
||||||
|
|
||||||
impl Function {
|
impl Function {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user