graalvm

grounded_sage 2023-09-28T07:30:09.182879Z

What is the status of graalvm from what I understand they are still not as fast for long term compute compared to JVM. Is there any claims from the team building Graal that it could match JVM as native binaries? Or get very close?

grounded_sage 2023-09-29T09:20:36.309159Z

Yea I have this working already. There just isn't a good webview option. I don't like the JavaFX one

borkdude 2023-09-29T09:20:55.174669Z

gotcha

lispyclouds 2023-09-28T07:33:03.912149Z

its quite close and even better under some circumstances: https://medium.com/graalvm/graalvm-for-jdk-21-is-here-ee01177dd12d

lispyclouds 2023-09-28T07:33:50.905119Z

Their most recent talk: https://vimeo.com/862028728

🙏 1
mkvlr 2023-09-28T07:37:22.063559Z

I saw Thomas WĂĽrtingers talk at StrangeLoop last week where he showed graphs how graal native now beats the JVM jit on all operational metrics (memory + throughput) thanks to the new profile guided optimizations.

mkvlr 2023-09-28T07:38:15.986369Z

talk was great btw

grounded_sage 2023-09-28T07:39:59.263339Z

So it sounds like it’s best to move on ideas with the assumption that a native binary will be the best option.

lispyclouds 2023-09-28T07:42:25.787389Z

The way I see it is if your app has a long enough running time or always on, start with the JVM and measure the performance with native and then decide. If it has a short running time start native. There are caveats to native compilation. The talk I linked shows it. Not all code can be native compiled

grounded_sage 2023-09-28T07:43:17.546709Z

Okay. I will watch talks. I am shipping a desktop app which is intended to be long running and doing a lot.

mkvlr 2023-09-28T07:43:38.419209Z

not needing a JVM might be nice for your users though

👍 1
grounded_sage 2023-09-28T07:43:56.025869Z

I was considering making it possible to do a webview like what Tauri offers.

grounded_sage 2023-09-28T07:44:30.388029Z

But I would need to learn C and do the bindings etc. so it is a significant investment of time and I need to consider if it is worth it.

grounded_sage 2023-09-28T07:47:23.921339Z

The idea is to have a locally running AI so people won’t mind something large with memory usage. But it’s silly to do that if native binary outperforms across all the metrics and I could just load into Tauri sidecar without doing the dive into C and all the work of creating bindings.

borkdude 2023-09-28T11:02:16.717699Z

If you want your binary to perform as well as JIT for specific payloads, you should use PGO

borkdude 2023-09-28T11:04:08.579199Z

I wouldn't start with optimizing though, just use -Ob or -O1 for less optimizations to first see if you can get stuff to work at all

grounded_sage 2023-09-28T11:06:09.050429Z

Cool. Yea I'm more curious about horizon potentials so I can consider that in my work prioritisation and architecture decisions.

borkdude 2023-09-28T11:06:38.243799Z

You could also just write your whole desktop app as a JVM app perhaps, e.g. with Niki's HumbleUI or plain JavaFX

borkdude 2023-09-28T10:14:57.333559Z

Upgraded #babashka to Oracle GraalVM 21. A few things to watch out for: • Use the /archive/ link instead of the /latest/ link to fetch a pinned version of GraalVM. • Use -march=compatibility if you distribute your binary for public use (else you'll likely get "The current machine does not support all of the following CPU features that are required by the image", I ran into this) • Use -O1 for similar outcomes as with GraalVM 22.3.0 CE (Note Oracle GraalVM 21 is newer, this version just follows the JDK version!): similar image size and compilation time. The default in Oracle GraalVM does more aggressive optimizations than CE, takes longer to compile and yields bigger images • PGO is good way to optimize your binary for specific payloads. A loop with 10M took 600ms before, now 300ms, same as you would get with babashka on JVM JIT).

ericdallo 2023-10-07T22:14:46.120599Z

I see this https://blogs.oracle.com/java/post/oracle-graalvm-for-jdk-21 > To reduce application compile times, some optimization phases that were previously included in the default level 2 (-O2) have been moved to a new level 3 (-O3). The level 3 optimizations work best with profile guided optimization, so they are automatically enabled when compiling with --pgo. The result is faster default compilation times with no significant impact on application performance. PGO continues to employ the same optimizations as in previous releases. I'm wondering if specifying --pgo is overwriting the -O1 with -O3 and makes a comparassion between with and without pgo not fair as one may be using -O1 and the other -O3, does that makes sense?

borkdude 2023-10-08T06:33:29.681319Z

Sure, then compare with O3

lread 2023-09-28T13:54:38.557869Z

Some good tips maybe for https://github.com/clj-easy/graal-docs

borkdude 2023-09-28T13:55:55.855059Z

hmyeah