GraalVM does not seem to have any effect on the start up time

clojure
#1

I am trying to get my Clojure program run on GraalVM. The start up time does not seem to improve even when running on GraalVM. It is almost the same as running on JVM which is ~2.38 seconds. I am not sure why this is happening. I have raised an issue here for the same.

EDIT :-
I ran it on GraalVM only after creating a native-image.

EDIT #2

Generating the native image

Timing on JVM - 1.059

Timing on GraalVM - 1.015

#2

I understand if you want to run Clojure JVM, but an effective way to improve startup speed would be to use CLJS. :slight_smile:

#3

Agreed. I am just wondering why it doesn’t seem to work with GraalVM

#4

GraalVM is “just” a JVM if you use it normally.

Creating a GraalVM native-image is what makes things start faster so you need to create that.

1 Like
#5

Yes,I did that!. I created the binary and ran

#6

Could you elaborate on exactly what you did, and how you checked the start-up time (as opposed to the full execution time of your code)?
If you managed to compile with native-image, and ran the resulting binary, the start-up time should be at least a couple of orders of magnitude faster than firing up a JVM.

#7

Sure! I have edited the post to reflect my exact steps with screen shots.

#8

The problem is that you are getting a fallback image, which falls back to a normal JVM. This means GraalVM could not turn your code into a binary because of some problem and then falls back to a non-native mode. You are running into this issue: https://dev.clojure.org/jira/browse/CLJ-1472
That can be fixed with a workaround: https://github.com/taylorwood/clojurl/commit/12b96b5e9a722b372f153436b1f6827709d0f2ab
But hopefully the patch for CLJ-1472 will make it into the next Clojure 1.10.1 release (@alexmiller?).

4 Likes
#9

oh okay :ok_hand:

But the https://dev.clojure.org/jira/browse/CLJ-1472 talk about ART(android run time).

#10

the solution for that problem also applies to GraalVM

1 Like
#11

cool, thanks :slight_smile:

#12

Not going to do anything in 1.10.1 - too “big” for the .1, but will consider in 1.11.

2 Likes
#13

Hey, thanks! The workaround worked:)

1 Like