5 ms·
I just wish it didn't target the JVM. I think if it had a native runtime that loaded quickly like Python it would be more popular. I love Clojure and really wis
by globular-toast 6y ago
I just wish it didn't target the JVM. I think if it had a native runtime that loaded quickly like Python it would be more popular. I love Clojure and really wish I could use it, but I just don't do the kind of things that can justify running a JVM.
- chrisseaton 6y agoHopefully that'll come with GraalVM.
- elwell 6y agoGraalVM, ClojureScript, etc...
- keymone 6y agoJVM is not to blame here, it's Clojure that takes a while to load and initialize. Java actually crushes Python in every aspect in terms of performance (which is to be expected of statically typed language).
- lvh 6y agoGP specifically mentioned startup time. It's true that most of the startup time for Clojure projects is a Clojure-specific interplay of things the JVM does (but also not language-intrinsic: ClojureScript on V8 does not share that problem, for example), but default flags CPython still beats default flags OpenJDK for "start and do nothing".
- keymone 6y ago> default flags CPython still beats default flags OpenJDK for "start and do nothing" i stand corrected :)
- dnautics 6y agoit's not the static typing that makes a difference, it's the compilation. As an extreme example, asm is very much not statically typed (hell it's not even considered typed in most circles), and it beats the pants off of Java. As another, less flippant, example, Julia will typically beat Java in most long-running algorithms (but probably not time-to-first-x), because it doesn't have a well-optimized-for-compilation-speed compiler, but it does have a better-optimized-for-running-speed compiler for many scientific tasks. https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/julia.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- igouy 6y agoIn that example, Julia also has someone who's spent many many hours writing and re-writing those few tiny programs to tune performance.
- deleted 6y ago[deleted]
- lvh 6y agoThis is definitely a valid criticism! Two ways that this may be getting better: GraalVM's native-image and babashka. babashka is a little interpreter that implements large portions of "scripting Clojure" so you can write tiny Clojure scripts the way you'd write bash or Python. GraalVM's native image is a Serious Compiler (unfortunately also with Serious RAM appetite and compile times, though this has gotten much better over the last few months) that will produce native binaries on Windows, macOS and Linux.
- dorian-graph 6y ago> babashka I recently was looking for something like this and I also found Planck, Lumo, and Eden. Do you (or anyone) know of a comparison between them?
- joobus 6y agoPlanck uses the os native webview for execution. Lumo runs on node. Eden is compatible with most clojure libraries, and is meant for embedding. Babashka is a clojure interpreter written in clojure and compiled with GraalVM. I've used Planck and babashka for shell scripting and prefer babashka.
- dorian-graph 6y agoThank you, that was a good overview! I started giving Babashka a quick go and it looks like it'll work well for what I wanted to use it for.
- brabel 6y agoHe explains how he created Clojure explicitly as a hosted language. After the JVM implementation, it quickly got implemented for CLR, and then JS (ClojureScript), and both are full implementations, not just look-alike. By all accounts, though, Clojure became as popular as it is because of the JVM, not despite it.
- JBiserkov 6y agoBtw, Rich had two versions of Clojure - Java (JVM) and .NET (CLR) and shortly before releasing it he decided to focus on the Java one, and deleted the .NET one.
- Skinney 6y agoClojureCLR still exists and is somewhat maintained (last commit was last year, but then again, little has happened in the clojure world in the past year so I'd still use it): https://clojure.org/about/clojureclr https://clojure.org/about/clojureclr
- JBiserkov 6y agoRight. What I was trying to express was that there have been 2 Clojures on the CLR: 1) The original one, developed by Rich Hickey in 2005-2007, which he deleted before releasing Clojure 2) The second one, known as ClojureCLR, which David Miller developed in 2008 from the ClojureJVM. https://soundcloud.com/defn-771544745/48-david-miller-and-clojure-on-the-clr https://soundcloud.com/defn-771544745/48-david-miller-and-cl...
- didibus 6y agoI find this very interesting, because it seems the programming landscape has changed quite a bit since Rich Hickey's world where he conceived Clojure. How he describes information systems, in that world, JVM is an amazing piece of technology that can hardly be surpassed. But today, the programming landscape goes far beyond that. ML and Data Science, infrastructure automation, serverless, etc. I also work in the world of enterprise information systems, so I'm always surprised about people saying the JVM doesn't work well for them. For me the JVM is the best piece of tech out there, only matched by the CLR. Even Go isn't up to par yet. But I reckon, other use cases value different execution characteristics. Low memory footprint is more important than raw performance. Throughput is more important than latency. Binary size is more important than portability. Startup times is more important than runtimes. Etc. Well the good news is that Clojure is meant to be hosted. And the JVM is only one of its many hosts. ClojureScript can run on NodeJS, eventually Deno, it can run on JavaScriptCore and in the browser. All these offer alternative execution models which can meet a new set of requirements. Clojure CLR is still real and robust, while it hasn't seen much use, it is ready at any time to take over. If the CLR provides to fulfill alternative execution characteristics it would be an option. Right now, the CLR has pretty much the same characteristics as the JVM though, which is why its use in Clojure hasn't seen a lot of popularity. Babashka and Joker are Clojure based runtimes, interpreters really, so exactly the same as what Python and Ruby offer. Babashka especially is picking up pace, and already starting to offer a really compelling set of alternate execution characteristics, specifically one where startup time trumps all. I'm also quite fascinated by Clojerl, a Erlang hosted Clojure. While less official, the maintainer is very active, and I feel it's actually now ready to be used in production. And there are more, smaller ones, but I'll skip those. What this shows is the landscape of possible runtimes is vast and will just keep expanding. Right now lots of experiment in having a Clojure hosted on Go, on Common Lisp, on Rust, etc. This a testament to Rich's hosted design. Clojure is easy to build on top of other runtimes. This ease really helps it grow and reach more use case. And there's the fact that the JVM is only getting better. GraalVM already offers native binaries with a small memory footprint, small binary, fast startup and still pretty fast performance. There are so many new garbage collectors coming along. Some for large heaps, small heaps, no heaps, tuned to throughout, latency, low memory, large memory, etc. P.S.: Also, I really urge you to reconsider a JVM. The truth is, it's such a powerful piece of technology that it can be hard to navigate and understand even what all it can do. I believe a lot of people are turned off by that and choose to use Go or Python because they have only one easy mode of operation. But the JVM can do so much, it's a worthy investment, it's very possible it has what you actually need. For example, you no longer need to install a JVM. Apps are self-contained. The user doesn't have to install a JVM, and the bundle contains only what the app uses, not the whole JVM. And as mentioned, compiled native binaries are also a possibility now.
- kinleyd 6y agoI started out with that view too. Now, after many years of using Clojure, I have come to love the JVM: so many of the libraries it comes with have become critical pieces of my daily workflow.