bitcoindevkit / bitcoindevkit/bdk-ffi

Better understanding library size

Open
#969 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
127
Forks
81
Avg merge
1d 2h
Merged PRs (30d)
5

Description

I've been thinking about how to reduce binary sizes for the libraries, mostly as I am looking forward to adding more clients to the lib, for example the [RPC client](https://github.com/bitcoindevkit/bdk-bitcoind-client), the [Electrum Streaming Client](https://github.com/bitcoindevkit/electrum_streaming_client), and [Floresta](https://github.com/getfloresta/Floresta).

In an attempt to better understand which part of the codebase is contributing to the binary size, I started by removing what I considered was probably the biggest culprits, the clients (partially because they ship with the whole http stack). The data surprised me a little bit.

### Current lib size on master (`2946cc1`) for Android binaries

```sh
14M arm64-v8a/libbdkffi.so
9.9M armeabi-v7a/libbdkffi.so
13M x86_64/libbdkffi.so
```

### Lib size if you remove all clients (Android binaries)

```shell
9.5M arm64-v8a/libbdkffi.so
7.0M armeabi-v7a/libbdkffi.so
8.8M x86_64/libbdkffi.so
```

## Mmmm....

Ok so the above is not quite what I was expecting. Take for example the most important of those, the `arm64-v8a`. From 14 to 9.5 MB? I was hoping to cut it down by much more.

It turns out that at least for Android, a big part of what's in this 9.5MB binary is the SQLite libary that is shipped wholesale with rusqlite (need more exact size data on this).

I'm not done the investigation on this, but I had enough to open the issue. More to come.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.