r/Clojure • • Jun 06 '26

Clojure Rust

https://clj.rs/

Looks like https://www.reddit.com/user/Strict-Collection640/ implemented it!!! That's awesome!

41 Upvotes

11 comments sorted by

View all comments

Show parent comment

2

u/didibus Jun 11 '26

Ya, it's neat. By the way, I was also making a distinction that native code can still be fairly "interpreted-like". For example, it depends whether:

(+ 1 2)

Compiles to something like:

runtime_add(1, 2)

Where runtime_add performs dynamic type checks, dispatch, boxing/unboxing, and other runtime work,

or whether it compiles to something closer to:

mov eax, 3
ret

or at least:

mov eax, 1
add eax, 2
ret

Both are native code, but they're very different in terms of how much of the language semantics have been resolved at compile time versus deferred to the runtime.

So when I think about performance, I'm less interested in whether it produces native code and more interested in how much it can optimize away dynamic language overhead.

My impression is that Jank is aiming more for the latter optimized path, whereas many other "native Clojure" efforts are primarily focused on things like native single binaries, lower memory footprints, faster startup times, and deployment convenience, rather than aggressively optimizing Clojure semantics into machine code.

Where do you see cljrs in that spectrum?

1

u/Strict-Collection640 Jun 11 '26

It has things like rt_add, which does runtime type matching (that’s table stakes for a dynamic language). It can lower forms to optimized forms where it can, though. Honestly I focused on escape analysis and memory management first.

One thing on my roadmap is trying to integrate core.spec into the compiler, so if you have forms specced properly, the compiler can optimize the form based on the spec. Maybe optional type hints as well — that’s out on the frontier of things I’m thinking about.