41 points · by silcoon · 1mo ago · 23 comments
This used to be discussed in the past and it has been proven that the culprit is the clojure implementation itself, the work done during startup, that regular Java code doesn't do, or can even take advantage of JIT caches/AOT.
"Why Clojure starts up slowly — is it really the JVM?"
https://ericnormand.me/article/the-legend-of-long-jvm-startu...
"Clojure's slow start — what's inside?"
https://clojure-goes-fast.com/blog/clojures-slow-start
"Why is Clojure bootstrapping so slow?"
https://blog.ndk.io/clojure-bootstrapping.html
"Babashka: How GraalVM Helped Create a Fast-Starting Scripting Environment for Clojure"
https://medium.com/graalvm/babashka-how-graalvm-helped-creat...
But the myth stays, because everyone has opinions based on perception.
Anyway, great to have Jolt as an option as well.
Chez and produces native binaries with startup in the microsecond range and around 8 to 13 megs in size. That's not just slightly faster than JVM Clojure for cold starts. The JVM is designed around a model where you have a long-lived process like an app server. Even if you optimize Clojure's bootstrap down to zero, you're still hauling around a heavy runtime.
And GraalVM native-image comes with its own set of trade-offs since it's based on a closed-world assumption, which means dynamic class loading, reflection, serialization, and so on all need to be configured at build time. So, you can't do eval at runtime, and Babashka ends up having to use an interpreter for anything dynamic. Bytecode isn't available at runtime either, so you lose a bunch of the debugging and monitoring tools as well.
The compile time is also brutal. Last I tried making native-image it took several minutes to build, and you have to be careful with how you write code or what libraries you use. It's not just a different compile target that works as a drop in. There's a significant cost if you're iterating that quickly makes you miss the REPL.
So yeah, the JVM isn't the only reason Clojure starts slowly, but it's still a major contributing factor. Also, as I point out in the post, there are lots of negative connotations with JVM in the broader programming community. People have been preaching that the JVM is not a problem for years now, but it's still shunned. An perception is just as much a barrier as a technical limitation.
Jolt shows what's possible when you drop the JVM entirely.
In case you didn't actually look at the links, but the evidence seems to point to this not being true (JVM startup is ~10% of the time)
> you're still hauling around a heavy runtime
> around 8 to 13 megs in size
I think if you jpackage a Clojure app with no GUIs or anything (that then bundles only the strictly necessary parts of the JVM) - it's around 50MBs. It's still embarrassingly slow to launch, involves ugly installers, doesn't provide crosscompilation and the memory usage makes Electron apps look lean.
That's to say, I think Jolt has a very valid place in all of this :) If I could plug in Clojure code and get out small fast executables for all major OSs (cosmopolitan?) that I can then share, that'd be useful for the rare situation I don't have any JVM dependencies
And yeah, Jolt solved this problem for me completely. Startup is fast, you get a single binary, and it runs anywhere Chez Scheme runs which is mac, Linux, Windows, Android, and iOS. The best part is that you can use FFI to access native ecosystem as easily as Python.
There's also some fun Burin's been working on porting OpenLdk to Jolt https://github.com/jlt-commons/jolt-openldk
It might make it possible to translate Java bytecode to Jolt, and then link it into the binary similarly to native libs as a statically linked fasl. That way there might not even be much of a runtime cost.
This is what tests are for. There should be no buildup of internal state that can't be arrived at with a simple invocation in a unit test.
Often, when you're building something new, you're not sure what the best approach is. So, you need room to experiment and try different things to see what works best. Writing tests boxes you into an approach out of the gate.
I like many of the ideas in Clojure, but I never learned it, so it doesn't matter to me what advantages it provides to an agent if I can't understand the code its creating. This year I've done a lot of work modifying open source applications I use with agents, some in languages I don't know. One is Metabase, which is written in Clojure. Another is Forgejo, written in Go. I had no real experience with either language.
Go was much, much easier to understand in that context. I could review the agents changes and follow data flow, follow tests etc.
And no, its not because I'm more familiar with similar imperative languages. The last 14 years I've written the most code in Elixir and Haskell. Lots of Javascript, C++ and Python as well. Admittedly no Lisp other than a bit of emacs but semantically Elixir is probably closer to Clojure than most Lisps are.
In fact, I've actually tried using Python and Js with LLMs initially because my logic was that these languages are more widely used and there's more training data. It's been a miserable experience for me, and I'm having a much better time with Clojure. I'm sharing my own experience here having actually used both types of languages, and the benefits I see in my workflow.
The fact that you're unable to learn Clojure is very much a you problem. I worked at a Clojure shop a while back where we hired university students regularly. They were able to pick up Clojure within a week or two and write useful code with it. The fact that somebody with over 14 years experience can't learn this language is absolutely surreal.
My understanding is that the main aim of Jank is to facilitate game development through tight integration with C++. And I think it's done some very interesting work on that front with the ability to generate LLVM bytecode on the fly. But it's not aiming to be a drop in replacement for Clojure.
So, I'd say that Jolt and Jank serve slightly different niches. My goal is to be able to build native binaries, have relatively good performance with fast stratup time, reasonable memeory use, and a high degree of compatibility with the JVM Clojure to run existing Clojure libraries. Jank appears to be aiming to be a highly optimized language bringing Clojure semantics to the C++ ecosystem.
but I think clojure is well suited for the age of llm's. token efficient .everything is data even the code is data is easy to deal with verification. pure functions etc.
however one will still need to know how to write / read clojure. when the industry is trending towards not reading code e.g the shit dhh has been parroting lately about not reading code and likewise many people in the industry.
Just today I got some project discussion related to Alokai (https://alokai.com/).
With platforms like this one, the whole programming is done in natural language, and the same attention given to the generated code, as most folks look into the Assembly output of their compilers.
This is now the trend across all SaaS products with extension points, the old SDKs are now legacy, or specific MCP tools, the new way is "agentic".
What I expect will happen is that we'll move more towards creating specs and contracts as developers that the LLMs will fill. And this works great with Clojure.
For example, I've been working on this library which lets you specify the state graph and constraints https://github.com/jlt-commons/writ
And I used it to formally encode Erlang OTP specs in a machine verifiable way here https://github.com/jlt-commons/ensemble/tree/main/test/ensem...
All I can say is best of luck to anybody trying to do something like that using natural language.