Skip to content

Possibly reduce crate size #202

@darnuria

Description

@darnuria

PR: #203

I ran cargo diet --dry-run(cargo diet project) on this crate and seems like it's possible to improve the size of the crate.

By default test are incorporated in the final crate and it can size up significantly the final crate. The rational about that? Not everybody in the world have top notch internet acces or a huge amount of space on the disk.

darnuria/remove-libcλ cargo diet --dry-run
┌────────────────────────────────────────────────────────────┬─────────────┐
│ File                                                       │ Size (Byte) │
├────────────────────────────────────────────────────────────┼─────────────┤
│ .gitignore                                                 │          41 │
│ .evergreen/run-tests.sh                                    │          70 │
│ .evergreen/run-tests-serde.sh                              │          85 │
│ .evergreen/run-tests-u2i.sh                                │          85 │
│ .evergreen/check-rustfmt.sh                                │         121 │
│ src/tests/modules/mod.rs                                   │         123 │
│ src/tests/mod.rs                                           │         155 │
│ .evergreen/check-clippy.sh                                 │         198 │
│ .evergreen/install-dependencies.sh                         │         214 │
│ examples/deserialize.rs                                    │         226 │
│ rustfmt.toml                                               │         236 │
│ src/tests/spec/json/bson-corpus/null.json                  │         258 │
│ src/tests/spec/json/bson-corpus/maxkey.json                │         275 │
│ src/tests/spec/json/bson-corpus/minkey.json                │         275 │
│ .travis.yml                                                │         287 │
│ examples/test.bson                                         │         316 │
│ src/tests/modules/lock.rs                                  │         419 │
│ src/tests/spec/json/bson-corpus/undefined.json             │         425 │
│ src/tests/spec/json/bson-corpus/boolean.json               │         685 │
│ examples/serialize.rs                                      │         705 │
│ etc/update-spec-tests.sh                                   │         838 │
│ src/tests/spec/json/bson-corpus/oid.json                   │         914 │
│ src/tests/spec/mod.rs                                      │        1092 │
│ src/tests/spec/json/bson-corpus/timestamp.json             │        1154 │
│ src/tests/spec/json/bson-corpus/document.json              │        1265 │
│ src/tests/modules/oid.rs                                   │        1290 │
│ src/tests/spec/json/bson-corpus/int32.json                 │        1431 │
│ src/tests/spec/json/bson-corpus/int64.json                 │        1522 │
│ src/tests/spec/json/bson-corpus/datetime.json              │        1710 │
│ src/tests/spec/json/bson-corpus/dbref.json                 │        1994 │
│ src/tests/spec/json/bson-corpus/array.json                 │        2022 │
│ src/tests/spec/json/bson-corpus/code.json                  │        2432 │
│ src/tests/spec/json/bson-corpus/multi-type.json            │        2469 │
│ src/tests/spec/json/bson-corpus/string.json                │        2812 │
│ src/tests/spec/json/bson-corpus/dbpointer.json             │        2819 │
│ src/tests/spec/json/bson-corpus/decimal128-6.json          │        3081 │
│ src/tests/spec/json/bson-corpus/regex.json                 │        3195 │
│ src/tests/spec/json/bson-corpus/symbol.json                │        3232 │
│ src/tests/spec/json/bson-corpus/double.json                │        3527 │
│ src/tests/spec/json/bson-corpus/code_w_scope.json          │        3580 │
│ src/tests/spec/json/bson-corpus/binary.json                │        3831 │
│ .evergreen/config.yml                                      │        4459 │
│ src/tests/modules/bson.rs                                  │        4800 │
│ src/tests/modules/ser.rs                                   │        5094 │
│ src/tests/spec/json/bson-corpus/multi-type-deprecated.json │        5420 │
│ src/tests/modules/ordered.rs                               │        6240 │
│ src/tests/modules/macros.rs                                │        6330 │
│ src/tests/spec/json/bson-corpus/decimal128-4.json          │        7135 │
│ src/tests/spec/corpus.rs                                   │        9534 │
│ src/tests/spec/json/bson-corpus/top.json                   │        9601 │
│ src/tests/spec/json/bson-corpus/bsonview                   │        9647 │
│ src/tests/modules/serializer_deserializer.rs               │       12790 │
│ src/tests/spec/json/bson-corpus/decimal128-7.json          │       12815 │
│ src/tests/serde.rs                                         │       13684 │
│ src/tests/spec/json/bson-corpus/decimal128-1.json          │       17989 │
│ src/tests/spec/json/bson-corpus/decimal128-5.json          │       23341 │
│ src/tests/spec/json/bson-corpus/decimal128-2.json          │       38784 │
│ src/tests/spec/json/bson-corpus/decimal128-3.json          │       90842 │
└────────────────────────────────────────────────────────────┴─────────────┘
Saved 64% or 334.2 KB in 59 files (of 523.7 KB and 80 files in entire crate)

The following change WOULD be made to Cargo.toml:
Diff - removed / added + :
[…skipped 12 lines…]
documentation = "https://docs.rs/crate/bson"
edition = "2018"
+include = ["src/**/*", "LICENSE", "README.md", "!**/tests/*"]

[features]
[…skipped 32 lines…]

If it's okay, I can do a pull-request about it.

Edit

Added link to pull-request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions