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

Document exclusion of Tink #2811

Open
3 tasks done
tomwmth opened this issue Mar 15, 2025 · 1 comment
Open
3 tasks done

Document exclusion of Tink #2811

tomwmth opened this issue Mar 15, 2025 · 1 comment

Comments

@tomwmth
Copy link

tomwmth commented Mar 15, 2025

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have updated to the latest JDA version
  • I have checked the branches or the maintainers' PRs for upcoming features.

Feature Request

I use JDA in a few production applications and had been wondering why the shaded JARs for those applications had gotten so much bigger since upgrading. As a result I decided to test exactly how much each JDA dependency contributes to final JAR size:

  1. Tink - 4.4MB
  2. Opus - 4.0MB
  3. OkHttp - 3.0MB
  4. Trove4J - 2.4MB
  5. Jackson - 2.2MB
  6. Commons Collections - 734KB
  7. Websocket Client - 121KB
  8. SLF4J - 66KB
  9. Jetbrains Annotations - 30KB

The Opus dependency was obvious, but my bots don't need audio so I was already excluding that. Even bigger than that though was Tink. Turns out thats also just audio and can be excluded in the same way. This should definitely be documented somewhere similar to how the Opus dependency is treated.

As a sidenote, the entire Kotlin standard library being pulled in just to use OkHttp feels a bit wasteful.

@freya022
Copy link
Contributor

While I think obsessing over JAR sizes is not necessary, it is reasonable enough to remove Tink when not using audio, you can open a PR documenting that.

As a side note, you can remove classes while shading to reduce the size. JDA builds minified artifacts, and you can look how it is done.

Another alternative when your bot runs in a container, is to not use shaded JARs, you can instead use jib to create docker images for your bot, which will efficiently build them.

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

No branches or pull requests

2 participants