Skip to content

Bundle size #1952

@darioAnongba

Description

@darioAnongba

Hi all,

Working on the BDK-WASM project, we wrap BDK around wasm-bindgen and expose its API. We've been very surprised by the size of the final bundle: https://www.npmjs.com/package/@metamask/bitcoindevkit/v/0.1.7?activeTab=code

As can be seen, the generated WASM is >3.2MB, and that's applying all known size optimizations and doing a thorough work on it. Given that we expected BDK to easily integrate in small devices such as hardware wallets, the size is very surprising.

We currently bundle bdk_wallet and bdk_esplora. bdk_wallet alone produces a 2.3MB bundle, with Esplora it takes 3.2MB and best I could do is around 3.1MB by removing some code. It doesn't seem to be inherent to how WASM is compiled either as very small packages can be produced with wasm-pack.

Would be great to get your insights on what is causing this size and whether it can be improved.

Use case
Usage in browser extensions such as Mozilla Addons require files to be <4MB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions