Home > Software engineering >  Jess - Performance regression from Java 11 to Java 13
Jess - Performance regression from Java 11 to Java 13

Time:02-03

we are using Jess, which is a rules engine, written in Java. It has become pretty old and most of it is written using Java 1.5 and lower language features. Now, we are using this for many years and never noticed any problems during the Java upgrades, until now, when we plan to switch from Java 11 to Java 17.

Our runtime has become 30-40% slower, just by switching the java version. We did a lot of testing already, but cannot really find the one culprit.
For instance, we checked different Java versions and different vendors (eclipse, azul and orcacle), everything from 13 was slower than Java 11.

Using VisualVM I was able to point down to a few methods, but there is nothing specific in there where I would say that this could be the problem.
Looking at it, it seems like there are multiple performance regressions that sum together to a big one, but that seems pretty unrealistic.

Some of the functions look like this:

    private synchronized Map findVariable(String key) {
        Context c = this;
        while (c != null) {
            Map ht = c.getVariables();
            Value v = (Value) ht.get(key);
            if (v != null)
                return ht;
            else
                c = c.m_parent;
        }
        return null;
    }

    private synchronized Map getVariables() {
        if (m_variables == null)
            m_variables = Collections.synchronizedMap(new HashMap());

        return m_variables;
    }

Do you know if there are any know regressions going on from J13 , maybe regarding synchronized functions and variables for instances?

Any other pointers what might be the problem?

CodePudding user response:

Based on the fact the library you are using was written for Java 1.5, that time we were primarily using synchronized keyword to write thread-safe code, I would say the root cause of performance degradation you are observing now is JEP 374: Deprecate and Disable Biased Locking

  • Related