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

Optimize primitive boxing #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Optimize primitive boxing #2

wants to merge 5 commits into from

Conversation

merkste
Copy link

@merkste merkste commented Sep 27, 2016

This pull request reduces memory strain and improves performance by avoiding the creation of duplicated primitive wrapper objects. To achieve this it exploits a) Java's built-in caches, e.g., IntegerCache (configure: -XX:AutoBoxCacheMax=) and b) auto-boxing.

@merkste merkste changed the title Optimize boxing Optimize primitive boxing Sep 27, 2016
Steffen Märcker added 5 commits October 10, 2016 16:14
In order to avoid the creation of multiple Integer instances, use
Integer#valueOf instead of Integer#new. This reduces memory and gc load.
In order to avoid the creation of multiple instances of true/false, use
Boolean#valueOf instead of Boolean#new. This reduces memory and gc load.
These changes remove some superfluous boxing/unboxing operations
and prepare for future JVM optimization similar to the Integer cache.
These changes help to exploit the Long cache.
@merkste
Copy link
Author

merkste commented Oct 10, 2016

I changed the comparator in JDDVars#sortByIndex in commit ae6b076 to avoid over/underflow, thanks @kleinj.

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.

1 participant