matrix-org / matrix-org/matrix-rust-sdk

[meta] Reducing the number of dependencies

Open
#5,989 2 comments 2 reactions 1 assignee Claimed by @Hywan View on GitHub
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description


Medusa (Bernini)


Hello,

This project has too many dependencies according to me.

The number of dependencies (regardless of their versions, features etc.)

```shell
$ cargo tree --all-features --edges all --prefix none | rg -v '^$' | cut -d' ' -f 1 | sort | uniq | wc -l
539
```

This is a meta issue aiming at reducing the number of dependencies, thus reducing the compile-time, and the resulting binary size.

## Removing duplicated dependencies

We have 35 duplicated dependencies:

```shell
$ cargo tree --all-features --duplicates | rg '^[a-z]' | datamash -W groupby 1 collapse 2 | tr '\t,' ' ' | sed -E -e 's/^([a-z0-9_\-]+)/* [ ] `\1`:/' | sed -E -e 's/(v.*) v/\1, v/g' | sed -E -e 's/v([0-9]+)/\1/g'
```

* [ ] `bitflags`: 2.10.0, 2.10.0
* [ ] `camino`: 1.2.1, 1.2.1
* [ ] `crypto-common`: 0.1.6, 0.1.6
* [ ] `darling`: 0.20.10, 0.21.1
* [ ] `darling_core`: 0.20.10, 0.21.1
* [ ] `darling_macro`: 0.20.10, 0.21.1
* [ ] `derive_more`: 1.0.0, 2.0.1
* [ ] `derive_more-impl`: 1.0.0, 2.0.1
* [ ] `digest`: 0.10.7, 0.10.7
* [ ] `getrandom`: 0.2.15, 0.3.1
* [ ] `hashbrown`: 0.14.5, 0.15.2, 0.16.1
* [ ] `indexmap`: 2.12.1, 2.12.1
* [ ] `itertools`: 0.10.5, 0.13.0, 0.14.0
* [ ] `js_int`: 0.2.2, 0.2.2
* [ ] `libc`: 0.2.175, 0.2.175
* [ ] `phf`: 0.11.2, 0.13.1
* [ ] `phf_shared`: 0.11.2, 0.13.1
* [ ] `rand`: 0.8.5, 0.8.5
* [ ] `rand_core`: 0.6.4, 0.6.4, 0.9.3
* [ ] `ruma-identifiers-validation`: 0.12.0, 0.12.0
* [ ] `rustix`: 0.38.41, 1.0.8
* [ ] `semver`: 1.0.27, 1.0.27
* [ ] `serde`: 1.0.228, 1.0.228
* [ ] `serde_core`: 1.0.228, 1.0.228
* [ ] `sha2`: 0.10.9, 0.10.9
* [ ] `siphasher`: 0.3.11, 1.0.1
* [ ] `strum`: 0.26.3, 0.27.2
* [ ] `strum_macros`: 0.26.4, 0.27.1
* [ ] `syn`: 1.0.109, 2.0.101
* [ ] `thiserror`: 1.0.63, 2.0.17
* [ ] `thiserror-impl`: 1.0.63, 2.0.17
* [ ] `toml_datetime`: 0.6.8, 0.7.2
* [ ] `unicode-width`: 0.1.13, 0.2.0
* [ ] `webpki-roots`: 0.26.3, 1.0.2
* [ ] `winnow`: 0.6.20, 0.7.13

## Reviewing dependencies

A list of things we should do:

- reviewing the features, see if `default-features = false` can be used to avoid pulling useless dependencies,
- find dependencies that do similar things, and pick a single one of them,
- find dependencies where a smaller one might exist,
- any other ideas?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.