[release/6.0][wasm] Change dotnet.wasm link optimization (#60632)
authorRadek Doulik <radek.doulik@gmail.com>
Wed, 10 Nov 2021 18:19:35 +0000 (19:19 +0100)
committerGitHub <noreply@github.com>
Wed, 10 Nov 2021 18:19:35 +0000 (10:19 -0800)
commit08e0023b3dc5aeb5c7173cb456c24398d93dd815
tree8b19e53594d685375028b447d5b20b887bec6d87
parentcf7d5173d4d9ce0aac8212e78063a097e1f57c0a
[release/6.0][wasm] Change dotnet.wasm link optimization (#60632)

* [wasm] Change dotnet.wasm link optimization

Context: https://github.com/dotnet/runtime/issues/60349

When we switched to Emscripten 2.0.21, we stopped using deprecated
`--llvm-opts 2` option. This caused unwanted performance degradation.
Switching to `-O2` get us similar performance as with `--llvm-opts`.

Blazor wasm test app `Time to first UI` benchmark times:

    branch/commit        link option    time    dotnet.wasm size
    --------------------+------------+--------+-----------------
    release/6.0 92ff02       -Oz       491ms    2,430,639
    release/6.0 92ff02       -O2       457ms    2,474,518
    release/6.0 92ff02       -O3       444ms    2,555,824

* Fix native build too

Co-authored-by: Larry Ewing <lewing@microsoft.com>
src/mono/wasm/Makefile
src/mono/wasm/build/WasmApp.Native.targets
src/mono/wasm/wasm.proj