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

Don't use nullable types on primitive to avoid tons of (un)boxing #11

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pelmenstar1
Copy link
Contributor

Type Int? in Kotlin JVM maps to reference type Integer. It causes memory allocations. In our case, nullability isn't necessary and can be avoided.

To save compatibility with the last version of the library, some variables types are explicitly marked.

Maybe we should break compatibility and then, boxed types won't be used at all.

Type Int? in Kotlin JVM maps to reference type Integer. It causes memory allocations. In our case, nullability isn't necessary and can be avoided.

To save compatibility with the last version of the library, on some variables types are explicitly marked.

_activeThumb's type is changed to non-nullable because the library never expects variable to be null.
@Droppers
Copy link
Owner

Looks good and in my opinion, it is okay to break compatibility for this, if you want to, of course, otherwise I will accept it as-is.

# Conflicts:
#	timerangepicker/src/main/java/nl/joery/timerangepicker/DefaultClockRenderer.kt
#	timerangepicker/src/main/java/nl/joery/timerangepicker/TimeRangePicker.kt
# Conflicts:
#	timerangepicker/src/main/java/nl/joery/timerangepicker/TimeRangePicker.kt
@pelmenstar1
Copy link
Contributor Author

Conflicts fixed!

Copy link

@saeed-lotfi saeed-lotfi left a comment

Choose a reason for hiding this comment

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

why you decreased version of libraries ?

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