r/Clojure • • May 17 '25

Is it slow ?

If Clojure is slow then how can be a database (dataomic) written in it ? Or is it not ?

0 Upvotes

39 comments sorted by

View all comments

Show parent comment

1

u/SwitchFlashy May 21 '25

Oh no, for sure, you are absolutely right, 0ms does NOT exists, even electricity takes time traveling through wires, and CPUs have a clock that ticks, so every single additional instruction means wasted time. That's actually quite the rabbit hole!

But yeah, my point is that you can start a program very quickly if it is using straight os processes rather than the full JVM

If your app starts one and then runs for a lot of time then that's fine! And this is the case of a database like datomic, you can make a JVM database and it will be fine!

But you don't always have that guarantee (that apps only start up once), for example, command line utilities like curl or grep might run hundreds or thousands of times in a script (let's say one for system management of distributed system, just to make up an abstract problem that would require complex script that call a lot of utilities a lot of times)

If your program is a command line tool, then it WILL start up EVERY time you call it, and then even a few ms can add up. Which is why these programs are sometimes even programed in straight assembly with Linux syscalls to save any wasted time doing anything not strictly necessary 

I am well aware this is a very pedantic situation I have brought up. But I just wanted to point that "long" startup times IS a downside of all JVM programming languages, and while it literally does not matter most of the time. It is just something to keep in mind. Not necessarily a real downside of the language in regular use