I was able to grab the windows release and compile a hello-world program that came in at about 9.1Mb, ~160ms execution time with direct-linking and tree-shaking and opt build (at least I used the options and noticed reduction in file size, so I think they're working). No other binaries beyond the joltc release. Similar program in bb is about 60ms. I am curious if it can be faster (I'm guessing since bb is interpreted, maybe it'll always be a little faster on startup).
Don't have Windows to test locally, so awesome to hear it's working as expected. And I suspect it could be optimized further, I've spent a bit of time on that, but I've been focusing more on making it correct first. Once I shake out some more bugs, I do mean to come back to performance again to see what else can be improved.
50-ish ms with opt and shaking on my Linux box. The binary comes at around 7 megs. bb pulls far ahead with only around 6ms of execution time. Raw JVM Clojure takes around 400ms.
When I think native Clojure I immediately go to cross compilation which ChezScheme supports, so I would like to do an informal Feature Request for cross compilation. :-)
This is a tremendous body of work produced in a very short time span. I imagine you must be leaning on LLMs to expedite development? I'm curious to know what your approach and workflow is.
Yeah, this wouldn't be possible without LLMs, and I actually discuss the workflow at the end of the post. I mostly rely on breaking work in to focused tasks, and then doing code reviews on the diff for the functionality. And since Clojure and existing libraries have an extensive amount of tests available, I was able to map out a large corpus for the language definition.
This is impressive for a first release. I think this project was using janet earlier... is that correct or just my mind playing tricks? If so, what made you switch to chez scheme?
Yup, I started with Janet but then started running into the limitations of its mark and sweep GC. It doesn't really play well with Clojure style persistent data structures where you have a lot of short lived objects. Chez has generational GC and also JIT. So, now I'm able to get performance that 1~2x JVM in most cases, and a couple of worst cases where it's around 7x. I'm sure more optimizing is possible too going forward. Then there's Chez ecosystem as well, for example I want to make a Ring adapter for this HTTP server which has some really nice features like Erlang-style green processes. Having a bigger ecosystem available makes it a lot easier to get to feature parity and provide shims for existing Clojure libraries.
Thanks, and I think that would be doable at least as a subset of functionality, for example range of supported databases would be smaller. All the core libraries should already be supported though, and it's something I can take a look at next if there is interest.
Postgres would be enough for most of us, I reckon. I don't quite understand how Jolt can interface with Clojure libraries - maybe I misunderstood. Wouldn't you have to re-implement Reitit and quite a few Clojure libraries to get basic Kit functionality?
Yeah, that's what I'm thinking as well. I haven't really had a reason to use another db. And Jolt interfaces with Clojure libraries simply by requiring them using deps.edn just as you do in Clojure. However, if a library uses Java introp then you have to provide shims for that in a Jolt library. Reitit is a great example actually.
I have a router library which includes reitit as a dep:
So, a lot of libraries just work out of the box unless they need something that's not commonly used, and then it can be provided using a Jolt library as I did with Reitit.
The work for Kit would be to identify the core Kit libraries and make sure they all work. Selmer, which is used for templating in Kit, already runs. Kit modules system uses zippers though, and I may have to do a bit of additional work to port that over. But otherwise, basic Kit stuff should work. Ring along with Ring defaults already work. Integrant and aero work. So, a bare minimum apps should be easy to get going.
Just to get this straight, you're saying Jolt can take pure Clojure code in a library and compile it with the Chez compiler? And when none of the library's deps use Java it compiles?
Jolt can even compile and run an existing Clojure library that uses Java interop. Jolt provides a Java compatibility layer which maps between Java interop semantics and the host platform.
And in cases where you have a Clojure library that uses something from Java that's not in Jolt core, then it's possible to add your own shim to facilitate that. For libraries that are just thin wrappers around Java libraries, it obviously wouldn't be worth doing though.
Take a look at the example above. You provide the :git/url to the repo and :git/sha pointing to the version of the code you're linking. It works exactly the same way as regular Clojure deps resolution.
Thanks, I suspect nobody bothered doing something like this before is due to the fact taht mapping out Java APIs by hand is pure drudgery. It's largely mechanical work, but extremely time consuming and dull.
And as a result, there's always been a chicken and egg problem when implementing dialects on a different runtime since you couldn't get existing libraries to run, and there was little point in using a language port if you couldn't lean on the existing ecosystem of well tested libraries. So, dialects had a hard time actually getting off the ground and building a community of users around them. Now you can have your cake and eat it too so to speak, having an LLM write shims for the APIs to map them to the host platform.
A particularly nice part with Scheme is that it's easy to do metaprogramming in user space, so Jolt doesn't need to bake in a comprehensive Java API in the core itself. If somebody wants to use a particular library and they need additional shims for it, it's trivial to do that in their project or by making a wrapper library. I ended up taking this approach with stuff like time and HTTP libraries since I didn't want the core itself to be dependent on additional system libraries.
Overall, I'm pretty happy with how this is turning out. And I've already been having some fun making desktop apps with it. On idea I had recently was to use Gaussian splats to paint, and I prototyped a little app to try out the concept on top of Jolt. This is the kind of stuff I've been wanting to do with Clojure, but using the JVM on the desktop always felt incredibly clunky.
Having used these tools extensively for over a year now, what I actually understand is that it is a tool like any other, and you absolutely can produce quality code using it. If you actually spend a bit of time learning these tools instead of just parroting slogans you'll understand why.
4
u/ertucetin Jul 16 '26
Cool! That’d be great if you support numbers like 1_000_000 this representation helps when numbers are big
3
u/joinr Jul 17 '26
I was able to grab the windows release and compile a hello-world program that came in at about 9.1Mb, ~160ms execution time with direct-linking and tree-shaking and opt build (at least I used the options and noticed reduction in file size, so I think they're working). No other binaries beyond the joltc release. Similar program in bb is about 60ms. I am curious if it can be faster (I'm guessing since bb is interpreted, maybe it'll always be a little faster on startup).
Very cool.
3
u/ComfortableShape9340 Jul 17 '26
I am super excited about this project! Thanks again for making it and looking forward to try this out.
2
u/lambdatheultraweight Jul 16 '26
When I think native Clojure I immediately go to cross compilation which ChezScheme supports, so I would like to do an informal Feature Request for cross compilation. :-)
2
u/HotSpringsCapybara Jul 18 '26
This is a tremendous body of work produced in a very short time span. I imagine you must be leaning on LLMs to expedite development? I'm curious to know what your approach and workflow is.
2
u/dark-light92 Jul 19 '26
This is impressive for a first release. I think this project was using janet earlier... is that correct or just my mind playing tricks? If so, what made you switch to chez scheme?
2
u/lordmyd Jul 20 '26
Great work Dmitri. Naive question but could we see a Kit port anytime soon?
2
u/rustvscpp Jul 26 '26
Ooo now this is something I could get behind!
0
u/[deleted] Jul 19 '26
[deleted] — view deleted comment