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

Stop maintaining the domain size for IntervalIntVarImpl. #1050

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

fhermeni
Copy link
Contributor

@fhermeni fhermeni commented Jul 6, 2023

For such variables, the solver used to track the lower-bound, the upper-bound and the domain size to provide quick access to the domain size. This decision had however a significant impact in terms of memory usage. It requires to have an additional StoredInt per variable and for every bound change, 2 values where saved into the stack.

In this patch, the domain size is no longer stored but computed on demand. In terms of performance, getDomainSize() performs now 2 get() and one subtraction while it used to perform one get(). On the other side it saves one StoredInt, and only one value is saved into the stack when a bound is updated.

After some internal experiments on (packing and scheduling) problems having around 100,000 bounded variables and 50,000 enum variables, this reduces the memory consumption of my JVM by about 30% with no performance degradation.

For such variables, the solver used to track the lower-bound, the
upper-bound and the domain size to provide quick access to the
domain size. This decision had however a significant impact in
terms of memory usage. It requires to have an additional StoredInt
per variable and for every bound change, 2 values where saved into
the stack.

In this patch, the domain size is no longer stored but computed on
demand. In terms of performance, getDomainSize() performs now 2
 get() and one subtraction while it used to perform one get(). On
 the other side it saves one StoredInt, and only one value is saved
into the stack when a bound is updated.

After some internal experiments on problems having around 100,000
bounded variables and 50,000 enum variables, this reduces the
memory consumption of my JVM by about 30% with no performance
degradation.
@cprudhom cprudhom merged commit 7f57e1c into chocoteam:master Jul 6, 2023
11 checks passed
@cprudhom cprudhom added this to the 4.10.14 milestone Oct 27, 2023
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