-
|
Hi, Is there any way to reduce this? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
|
Can you provide more details? Which versions of Cats/Scala, which platform? |
Beta Was this translation helpful? Give feedback.
-
|
We are using Getting file size curl -O https://repo1.maven.org/maven2/org/typelevel/cats-core_3/2.13.0/cats-core_3-2.13.0.jar
du -h cats-core_3-2.13.0.jar
# 6.8M cats-core_3-2.13.0.jar
unzip cats-core_3-2.13.0.jar
du -sh cats
# 30M cats
When extracting our fat jar MacOS finder tells me the following for the cats folder We are using sbt assembly for generating the fat jar. |
Beta Was this translation helpful? Give feedback.
-
|
I think |
Beta Was this translation helpful? Give feedback.
-
|
I guess there are lots of other arity-specifc traits in Cats that contribute to the inflated module size too, e.g.: A sad part here is that most of the higher-arity traits and methods are rarely used, but sit in the jar anyway. Perhaps, one of possible solutions could be generating two different cats-core artifacts, e.g. cats-core itself as a "full-sized" one, and cats-core-min as a minimalistic version that only contains arities up to some modest number, e.g. 5 or 6. Another part that could be somehow optimized: there are some non-essential data types like NonEmptyList, NonEmptyVector, etc that might not be exactly required for everyone who depends on cats-core for its typeclasses only. Therefore, such data classes could be extracted into a separate module in order to reduce the size of the core one, I think. |
Beta Was this translation helpful? Give feedback.
-
|
The problem was addressed (to some extent) in #4751. |
Beta Was this translation helpful? Give feedback.
The problem are not just the arity functions by themselves. The issue is that they are generated in traits and those traits generate bridge methods in every subclass. They should have been generated as abstract classes.