stellar / soroban-example-dapp

End-to-End Example Soroban Dapp
Apache License 2.0
1.06k stars 853 forks source link

Remove crate-type rlib from build config #51

Closed leighmcculloch closed 1 year ago

leighmcculloch commented 1 year ago

What

Remove crate-type rlib from build config.

Why

When rust builds two crate types at once some optimizations are disabled (e.g. LTO) is disabled, which results in bloated .wasm files. We don't need rlib enabled because we're building a .wasm file, and not a library.

Before

Build with stable + wasm-opt:

-rw-r--r--  1 leighmcculloch  staff  13841 Oct 31 08:17 soroban_crowdfund_contract.wasm

Build with nightly + wasm-opt:

-rw-r--r--  1 leighmcculloch  staff  9151 Oct 31 08:17 soroban_crowdfund_contract.wasm

After

Build with stable + wasm-opt:

-rw-r--r--  1 leighmcculloch  staff  6966 Oct 31 08:17 soroban_crowdfund_contract.wasm

Build with nightly + wasm-opt:

-rw-r--r--  1 leighmcculloch  staff  6323 Oct 31 08:17 soroban_crowdfund_contract.wasm