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 published gem size #113

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Reduce published gem size #113

merged 1 commit into from
Aug 17, 2023

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Aug 15, 2023

Purpose

This Pull Request reduces the published gem size by excluding unneeded files for execution.
The latest version's gem size is 98.5 KB.

image

https://rubygems.org/gems/trino-client/versions/2.0.0

Overview

The PR updates the files option in the gemspec file.

You can confirm the size diff by the following verification: 100K -> 84K (-16K)

$ git checkout master && gem build -o before.gem
...
$ git checkout reduce-published-gem-size && gem build -o after.gem
...
$ du -h before.gem after.gem
100K	before.gem
 84K	after.gem

Here are files included in the packed gem file:

$ gem build && gem unpack *.gem
...
$ tree trino-client-2.0.0/
trino-client-2.0.0//
├── ChangeLog.md
├── LICENSE
├── README.md
├── SECURITY.md
├── lib/
│   ├── trino/
│   │   ├── client/
│   │   │   ├── client.rb
│   │   │   ├── errors.rb
│   │   │   ├── faraday_client.rb
│   │   │   ├── model_versions/
│   │   │   │   ├── 0.149.rb
│   │   │   │   ├── 0.153.rb
│   │   │   │   ├── 0.173.rb
│   │   │   │   ├── 0.178.rb
│   │   │   │   ├── 0.205.rb
│   │   │   │   ├── 303.rb
│   │   │   │   ├── 316.rb
│   │   │   │   └── 351.rb
│   │   │   ├── models.rb
│   │   │   ├── query.rb
│   │   │   ├── statement_client.rb
│   │   │   └── version.rb
│   │   └── client.rb
│   └── trino-client.rb
└── trino-client.gemspec

5 directories, 22 files

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

This change reduces the published gem size by excluding unneeded files for execution.

Size diff: 100K -> 84K

```console
$ git checkout master && gem build -o before.gem
...
$ git checkout reduce-published-gem-size && gem build -o after.gem
...
$ du -h before.gem after.gem
100K	before.gem
 84K	after.gem
```
@ybiquitous ybiquitous marked this pull request as ready for review August 15, 2023 13:37
@ybiquitous ybiquitous requested a review from a team as a code owner August 15, 2023 13:37
@yuokada yuokada self-requested a review August 17, 2023 02:31
Copy link
Contributor

@yuokada yuokada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅ Thanks.

If a new gem package is necessary, please let me know. I will publish.

@ybiquitous
Copy link
Member Author

If a new gem package is necessary, please let me know. I will publish.

Yeah, I need a new version with decreased size. Can you publish it? Thanks.

@yuokada yuokada merged commit 4e03819 into master Aug 17, 2023
@exoego exoego deleted the reduce-published-gem-size branch August 17, 2023 08:20
@yuokada
Copy link
Contributor

yuokada commented Aug 17, 2023

@ybiquitous Published v2.0.1.
https://rubygems.org/gems/trino-client/versions/2.0.1

@ybiquitous
Copy link
Member Author

Thank you! 🎉

image

https://rubygems.org/gems/trino-client/versions/2.0.1

And much better diff of the gem!
https://my.diffend.io/gems/trino-client/2.0.0/2.0.1

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