Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce crate size from 4.8MB to to 34kB by adjusting the Cargo manifest #32

Merged
merged 1 commit into from
Dec 31, 2020

Conversation

Byron
Copy link
Contributor

@Byron Byron commented Dec 31, 2020

This commit is more of a suggestion and the start of a conversation
as it removes all files not required to build from the packaged crate.

Please let me know if keeping tests is preferred in this case, or if
there are any other files that should rather remain included.

This was achieved with cargo diet -r, here is the output indicating the savings:

┌───────────────────────────────────────────┬─────────────┐
│ File                                      │ Size (Byte) │
├───────────────────────────────────────────┼─────────────┤
│ .github/FUNDING.yml                       │          63 │
│ .gitignore                                │         313 │
│ .github/ISSUE_TEMPLATE/feature_request.md │         601 │
│ snap/snapcraft.yaml                       │         626 │
│ .github/ISSUE_TEMPLATE/bug_report.md      │         736 │
│ .brew/t-rec.rb                            │         898 │
│ .brew/t-rec-not-working-on-github.rb      │        1327 │
│ resources/list.c                          │        2249 │
│ .github/workflows/build.yml               │        3409 │
│ .github/workflows/release.yml             │        5686 │
│ docs/demo-mint.gif                        │       33928 │
│ docs/demo-ubuntu-i3wm.gif                 │       36705 │
│ docs/demo-ubuntu.gif                      │       38521 │
│ docs/demo-shadow.gif                      │      163219 │
│ docs/demo.gif                             │     1158944 │
│ docs/demo-vscode.gif                      │     1177428 │
│ docs/demo-chrome.gif                      │     1857443 │
│ tests/frames/t-rec-frame-000004876.tga    │     2678162 │
│ tests/frames/t-rec-frame-000004607.tga    │     2678162 │
│ tests/frames/t-rec-frame-000004334.tga    │     2678162 │
│ tests/frames/t-rec-frame-000004064.tga    │     2678162 │
│ tests/frames/t-rec-frame-000003784.tga    │     2678162 │
│ tests/frames/t-rec-frame-000003516.tga    │     2678162 │
│ tests/frames/t-rec-frame-000003237.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002960.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002685.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002403.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002131.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001848.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001576.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001306.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001036.tga    │     2678162 │
│ tests/frames/t-rec-frame-000000775.tga    │     2678162 │
│ tests/frames/t-rec-frame-000000512.tga    │     2678162 │
│ tests/frames/t-rec-frame-000000251.tga    │     2678162 │
│ resources/t-rec-frame-000000251.tga       │     4757778 │
└───────────────────────────────────────────┴─────────────┘
Saved 100% or 57.4 MB in 36 files (of 57.5 MB and 53 files in entire crate)

This commit is more of a suggestion and the start of a conversation
as it removes all files not required to build from the packaged crate.

Please let me know if keeping tests is preferred in this case, or if
there are any other files that should rather remain included.

This was achieved with `cargo diet -r`, here is the output:

┌───────────────────────────────────────────┬─────────────┐
│ File                                      │ Size (Byte) │
├───────────────────────────────────────────┼─────────────┤
│ .github/FUNDING.yml                       │          63 │
│ .gitignore                                │         313 │
│ .github/ISSUE_TEMPLATE/feature_request.md │         601 │
│ snap/snapcraft.yaml                       │         626 │
│ .github/ISSUE_TEMPLATE/bug_report.md      │         736 │
│ .brew/t-rec.rb                            │         898 │
│ .brew/t-rec-not-working-on-github.rb      │        1327 │
│ resources/list.c                          │        2249 │
│ .github/workflows/build.yml               │        3409 │
│ .github/workflows/release.yml             │        5686 │
│ docs/demo-mint.gif                        │       33928 │
│ docs/demo-ubuntu-i3wm.gif                 │       36705 │
│ docs/demo-ubuntu.gif                      │       38521 │
│ docs/demo-shadow.gif                      │      163219 │
│ docs/demo.gif                             │     1158944 │
│ docs/demo-vscode.gif                      │     1177428 │
│ docs/demo-chrome.gif                      │     1857443 │
│ tests/frames/t-rec-frame-000004876.tga    │     2678162 │
│ tests/frames/t-rec-frame-000004607.tga    │     2678162 │
│ tests/frames/t-rec-frame-000004334.tga    │     2678162 │
│ tests/frames/t-rec-frame-000004064.tga    │     2678162 │
│ tests/frames/t-rec-frame-000003784.tga    │     2678162 │
│ tests/frames/t-rec-frame-000003516.tga    │     2678162 │
│ tests/frames/t-rec-frame-000003237.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002960.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002685.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002403.tga    │     2678162 │
│ tests/frames/t-rec-frame-000002131.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001848.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001576.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001306.tga    │     2678162 │
│ tests/frames/t-rec-frame-000001036.tga    │     2678162 │
│ tests/frames/t-rec-frame-000000775.tga    │     2678162 │
│ tests/frames/t-rec-frame-000000512.tga    │     2678162 │
│ tests/frames/t-rec-frame-000000251.tga    │     2678162 │
│ resources/t-rec-frame-000000251.tga       │     4757778 │
└───────────────────────────────────────────┴─────────────┘
Saved 100% or 57.4 MB in 36 files (of 57.5 MB and 53 files in entire crate)
@Byron Byron changed the title reduce crate size to 34kb by adjusting the Cargo manifest reduce crate size from 4.8MB to to 34kB by adjusting the Cargo manifest Dec 31, 2020
@sassman
Copy link
Owner

sassman commented Dec 31, 2020

Nice! I was not aware of diet. Thanks a lot.

The only question is if the gifs in docs/* that are also shown and linked in the README.md will still appear on crates.io with this configuration? I don't know in detail how things are rendered on crates.io this is why I'm asking.

@Byron
Copy link
Contributor Author

Byron commented Dec 31, 2020

Great to hear! Thanks :). diet is quite a niche thing, exactly the niche I needed it for :D.

The only question is if the gifs in docs/* that are also shown and linked in the README.md will still appear on crates.io with this configuration?

I think it will, as the actual image link it produces is https://github.com/sassman/t-rec-rs/raw/HEAD/docs/demo.gif, crates.io doesn't host these itself from crate sources.

@sassman sassman merged commit 7437ef8 into sassman:main Dec 31, 2020
@sassman
Copy link
Owner

sassman commented Dec 31, 2020

Nice, thanks again for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants