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

Add Char/Byte specialization to kernel typeclasses #4547

Closed
wants to merge 2 commits into from

Conversation

vbergeron
Copy link

This PR add specialization for two more primitive types for Typeclasses in the kernel.

Bytes and, in a lesser extend, Chars, are fundamental types in many domains and I feel this is worth an addition. This does have an effect in JAR size though.

Size tested using scala 2.13 (publishLocal).

size
Current (5c5fe56) 3.58 MB
This PR (82a342e) 3.72 MB

Looking forward your feedback !

@vbergeron vbergeron closed this Jan 8, 2024
@johnynek
Copy link
Contributor

johnynek commented Jan 8, 2024

The reason why this is usually not done is that it increases the size of all the traits but boxing is cheaper for Byte and Char because they are generally cached:

https://github.com/openjdk/jdk/blob/d47393bd8225e818f0f9cd45192a5e656018af11/src/java.base/share/classes/java/lang/Byte.java#L149

https://github.com/openjdk/jdk/blob/d47393bd8225e818f0f9cd45192a5e656018af11/src/java.base/share/classes/java/lang/Character.java#L9008

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.

3 participants