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

Performance degradation when moving to GraalJS 23.1.1 (and GraalVM for JDK21) #779

Open
efimbakulin opened this issue Nov 7, 2023 · 1 comment
Assignees

Comments

@efimbakulin
Copy link

Hey!

After moving our project to the latest version of GraalVM its performance degraded drastically (up to 2 times). The internal logic of the project is quite complex, but I've prepared a synthetic test showing the performance difference between GraalVM 22.3.3 and GraalVM for JDK21. The test simply makes a bunch of calls to the jsonParseStringify() function defined as follows:

const OBJECT_SIZE = 500;
const obj = {};

for (let i = 0; i < OBJECT_SIZE; i++) {
    obj["double_key" + i] = Math.random();
    obj["str_key" + i] = '#'.repeat(50);
};

function jsonParseStringify() {
    return JSON.parse(JSON.stringify(obj));
};

module.exports = {
    jsonParseStringify
};

It gives the following numbers in case of GraalVM 22.3.3

warming up
....................................................................................................
Iterations: 100000
Duration: 125.514641
Score: 796.719788 ops/second

testing
....................................................................................................
Iterations: 10000
Duration: 12.805132
Score: 780.936890 ops/second

and the following ones in case of GraalVM JDK21:

warming up
....................................................................................................
Iterations: 100000
Duration: 157.155243
Score: 636.313477 ops/second

testing
....................................................................................................
Iterations: 10000
Duration: 15.578632
Score: 641.904846 ops/second

The complete project may be found here https://github.com/efimbakulin/graalvm-jdk21-performance-test

Could you please give it a look? Probably there are some options which should be enabled to improve the things?

@woess woess self-assigned this Nov 13, 2023
@efimbakulin
Copy link
Author

efimbakulin commented Feb 23, 2024

Hi!

Many thanks for the improvements already done. The numbers looks much better, although they are not as good as for 22.3.3.

Here are my new measurements:

22.3.3

warming up
....................................................................................................
Iterations: 100000
Duration: 123.946686
Score: 806.798523 ops/second
testing
....................................................................................................
Iterations: 10000
Duration: 12.107336
Score: 825.945496 ops/second

JDK21 (23.1.1)

warming up
....................................................................................................
Iterations: 100000
Duration: 141.798828
Score: 705.224426 ops/second
testing
....................................................................................................
Iterations: 10000
Duration: 14.073600
Score: 710.550232 ops/second

24.1.0-SNAPSHOT (commit 39b63b9a2202e1c10248357161ea5e63e2934792)

warming up
....................................................................................................
Iterations: 100000
Duration: 127.519096
Score: 784.196289 ops/second
testing
....................................................................................................
Iterations: 10000
Duration: 12.662384
Score: 789.740723 ops/second

To run the test against 24.1.0-SNAPSHOT, I invoked the following commands within the GraalJS repository:

mx build
mx maven-install --repo <M2_REPO_ROOT> --only GRAALJS --version-string 23.1.1

Here, M2_REPO_ROOT denotes the root of the .m2 repository used to test GraalJS version 23.1.1. After that I rerun the test for GraalJS 23.1.1 using the newly built GraalJS jar files.

Is that enough or do I need to install some additional artifacts?

Thanks.

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

No branches or pull requests

2 participants