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

Commits on Jul 6, 2023

  1. Stop maintaining the domain size for IntervalIntVarImpl.

    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.
    fhermeni committed Jul 6, 2023
    Configuration menu
    Copy the full SHA
    35ad671 View commit details
    Browse the repository at this point in the history