Fork me on GitHub

How likely is it that GraalVM becomes a reasonable default?


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.


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.


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


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


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


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.


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


The result is better performance


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?


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.


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


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". 🙂.


> 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.


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


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


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. :)


@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) 🙂


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


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


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.


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


@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.


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 :(


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


Compared to every other JVM I know 😄


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, that while a little old it does reproduce what I see on my development machine 🙂


Here's at least something: 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.


@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


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


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...