Fork me on GitHub
#off-topic
<
2020-08-12
>
mloughlin08:08:06

How likely is it that GraalVM becomes a reasonable default?

mloughlin11:08:00

I guess general purpose JVM? I know you're doing great work with command line apps, and for the same reasons it seems like a nice fit for Lambda/FaaS. I was browsing the Graal website and they make a lot of claims about great performance but it's not so clear what the trade-offs are.

p-himik11:08:27

IIRC some people mentioned that GraalVM is good for startup (i.e. good for short-running apps that are used more or less often) but bad for long running applications because it can't do the same runtime optimizations the regular JVM can do.

dominicm11:08:58

That's not true @p-himik. Native image has those limitations, but graalvm does not.

dominicm11:08:27

I know some people using graalvm as their default jvm for work and I think things mostly just work.

p-himik11:08:07

Ah, OK, I stand corrected then. I was almost certain that using GraalVM always means ending up with a native image.

dominicm11:08:14

Nope. Graalvm is a jvm where the jit(? Might be a different part I'm thinking of) is written in java rather than natively. That's the big sell really. Writing optimizations in java is much easier.

jumar13:08:48

I think that's a "big sell" for JDK implementors; not so much for consumers / regular programmers

dominicm14:08:26

The result is better performance

jumar16:08:04

I don’t think they are there yet. The original C2 compiler has decades of development and optimization behind it. Do you have links to any trustworthy resources demonstrating the performance improvements?

dominicm16:08:00

Nope. I've heard the same as you. Although graalvm has some 1% speed up charts on their site, I've never investigated. The value seems to be that they can bring those optimizations to ruby etc. And they're making other languages as fast as java.

dominicm11:08:41

I think one could hypothetically write some optimizations which targeted clojure specifically, but I don't think anyone is doing that.

dangercoder20:08:46

Except the fast feedback loop through repl-driven development, don't you agree that the data-oriented aspect of Clojure (working with .edn) is a superpower? I have a sql server stored procedure returning about 500 properties in a map, imagine having to create an object that represents this data in e.g C# or Java for test purposes. What would you do? If you have transformation logic, how do you write test-cases in a practical way? "I have this input, and this is the expected output that we put on a MQ". 🙂.

p-himik21:08:28

> imagine having to create an object that represents this data in e.g C# or Java for test purposes. What would you do? I would just create a map.

seancorfield21:08:58

@p-himik Yeah, but so many C#/Java folks would just go to ORM at that point...

seancorfield21:08:12

(...and they would deserve everything they get at that point 🙂 )

p-himik21:08:40

I think Hibernate supports executing arbitrary queries and returning a list of maps. A quick search suggests that's correct. But of course I agree with your statements anyway. :)

dangercoder21:08:43

@p-himik this map is also nested, how do you represent this data in C# or Java? Maps in maps, and that comes with some semantics that "hides" the actual data shape such as Put... etc (maybe it's better in 2020): It's of course doable in C# and Java, but there is some more work and some more "stuff" that one has to think about (Imo) 🙂

p-himik21:08:22

Uhm, why is it nested? I imagine a row is a map.

dangercoder21:08:04

Yeah, i'm refering to JSON or something else that can be nested in my previous reply. My bad.

p-himik21:08:04

Then yeah, maps of maps. Not different from Clojure in terms of the data shape. But quite a bit more cumbersome, mostly because of all the typing.

dangercoder21:08:51

Exactly. In Clojure you can work with data, which you can copy around. Of course there are trade-offs, but for some domains, e.g where you transform X to Y most of the time... it's quite nice to use something that makes this kind of thing practical

mauricio.szabo23:08:34

@michael.e.loughlin I don't see this "great performance improvement" on most of my projects. What I do see is about 15% increase in memory usage.

mauricio.szabo23:08:52

That's one of the reasons I prefer OpenJ9 JDK - memory consumption is really low there. It's a pity that ClojureScript compiler does not work that well with it :(

jumar08:08:07

This is interesting: > memory consumption is really low there Compared to what? Do you have any numbers to show?

mauricio.szabo18:08:07

Compared to every other JVM I know 😄

mauricio.szabo18:08:41

For a rough comparison, while I'm developing Chlorine (a package for the Atom editor, written in ClojureScript) I mostly use OpenJDK because compilation of CLJS in OpenJ9 sometimes give me strange results. So, after about 30 minutes, OpenJDK is showing 11% of my memory is being used for the Shadow-CLJS watch task. Most of the time, I can't have 11% of my memory being used so I change to OpenJ9. The same process, same arguments, is now showing 6.5% memory usage. There's also this article https://technology.amis.nl/2018/12/09/jvm-performance-openj9-uses-least-memory-graalvm-most-openjdk-distributions-differ/, that while a little old it does reproduce what I see on my development machine 🙂

jumar14:08:00

Here's at least something: https://www.royvanrijn.com/blog/2018/05/openj9-jvm-shootout/#comment-3904117577 I sympathise with this comment: > Without actually knowing what youre doing, sure, the default settings on different JVMs can result in different heap sizes with the same workload.... But it wont have anything to do with one or the other being more efficient with memory.

mauricio.szabo14:08:42

@U06BE1L6T this is what people always say when I show these comparisons. The thing is, I've tried lots of different settings - none was able to beat OpenJ9

jumar14:08:49

Maybe it works well for certain kind of applications. I might try this on some of my own projects to see how it compares

mauricio.szabo19:08:43

Well, I saw it consistently beating in memory every app I have on my machine, both that I'm writing and also java-based apps like DBeaver, yEd, etc...