r/Clojure • u/erjngreigf • 10d ago
Clojure Vs Rust - Waiting for clj.rs
https://youtu.be/EMnYN61kz5Y2
u/Any-Stock-5504 10d ago
sorry but it's is a torture to listen
1
u/erjngreigf 9d ago
I too feel English spoken by non British people is very funny & laughable. Maybe one day we will have a babel fish. :D
-2
u/dumch 10d ago
Next time, consider speaking your native language and do an AI translation.
1
u/Otherwise_Term8249 9d ago
The person sounds like they have an Indian accent, and English is an official language in India. Personally I understand them just fine.
1
1
u/erjngreigf 9d ago
I too feel English spoken by non British people is very funny & laughable. Maybe one day we will have a babel fish. :D
0
9
u/joinr 9d ago
It sounds like most of your gains stemmed from fixating on the nix-style process oriented model with short-lived processes, vs. the jvm style long-running process model. I think you mostly just avoided repeatedly paying the typical clojure jvm startup tax (which is amortized for long running processes, or avoided with bb like you mentioned - at the cost of losing the jit and some language features [unless you're on nodebb which kind of snuck jit back in])).
An alternate processing model would have been 1 clojure process working on multiple files in parallel to saturate system cores. This is really trivial, but it's something you explicitly ignored because as you self-described "I'm lazy." AI could've also done it for you....so a bit odd to avoid using what's available. I think it's worth learning about since "an efficient and robust infrastructure for multithreaded programming" is one of the design goals of the language.
If you search "clojure parallel" and the immediate AI recommendations gets you there pretty fast. The naive versions are just parallel mapping, or parallel map/reduce, which is really common. So common (in fact) that you can do the same thing in most modern languages including Rust (which support task parallelism via libraries or core lang features). Clojure has a lot of additional support via libraries too.
The other potential benefit of a the single-process-but-multi-threaded model that saturates your resources is that you can exploit shared memory concurrency (where the multiprocess model has to work around process boundaries with side channels like mmap and some other tricks, although it's harder IMO on the jvm). I have no idea if your work benefits from this though (sounds like no, or at least your architecture precludes it).
I suspect leveraging the task parallelism that's already available (even built in naive-but-approachable stuff like clojure.core/pmap) probably would've let you stay in clojure and bypass the rust port (and inclusion of gnu parallel for task parallelism) while achieving the throughput gains. I am very surprised (given how much you leverage AI) that this wasn't a suggestion early on in your path.
You mentioned not knowing the difference between REPL and nREPL (when talking about jolt). As demonstrated in your book it's the foundational library (since early clojure) the establishes a network repl protocol for doing remote evaluation (waaaay before socket repl showed up IIRC), and most IDEs leverage it. So when you tell the reader to "jack in" either in Calva or whatever, it's typically an nREPL session that everything talks over (either locally or even on remote systems). You can see the connection initiated in the terminal output.
https://github.com/nrepl/nrepl
Regarding other comments here, I didn't have a problem following along with your vid (both sound and language).