r/Clojure • u/pavelklavik • Jul 02 '25
All Programming Languages are Fast (+ showcase of Clojure powers)
https://orgpad.info/blog/all-programming-langs-are-fast
53
Upvotes
r/Clojure • u/pavelklavik • Jul 02 '25
13
u/wedesoft Jul 02 '25
I think, Clojure binds methods at compile time. At least you get a compile time error if a symbol was not defined. Python on the other hand seems to look up the method name only at call time. This fundamentally limits the performance unless you change the semantics of it. C methods are furthermore non-polymorphic by default.
In Clojure you can also uses macros (defmacro, definline) to inline code. From the other languages in above picture, only Rust supports this (unless you think of C preprocessor macros).
Often it is said that a language does not have performance, it is the interpreter/compiler implementing it. However language features such as dynamic typing and late binding can make it much harder to implement a compiler generating machine code with high performance.
12
u/coderemover Jul 02 '25
People who write such things and put Java and C++ in one sentence claiming they are the same league either never tried writing high performance software in Java or they don’t know a shit about C++ or code optimization.
I’ve been doing high performance Java for 15+ years and this language is absolutely fantastic at ruining any advancements in hardware performance. I’ve beaten highly optimized Java code written by Java experts by rewriting it to C++ or Rust many times by 3x to 5x easily on CPU and often more than 10x on memory use. But for that to work it’s not enough to natively rewrite code. You need to actually know how to use strengths of C++ or Rust.
However, one thing I agree with - languages don’t split between slow and fast but more about the ones that give you a lot of control and the ones that force the choices on you. C++ and Rust are in the former camp while Java, Go and Closure are in the latter. Sometimes the choice made by the language designer is optimal and then you can see the code is good and will be hard to beat. But more often it’s not and then in language like Java or Go you don’t have many ways to get out.
8
u/v4ss42 Jul 02 '25
Beyond the (valid) complaints about the article, I’d argue that the entire framing of “slow vs fast” is meaningless. What matters is fast enough for my use case, which is why “slow” languages (Python, Ruby etc.) remain valid choices in many situations.
FWIW my experience has been that the JVM (and Clojure) are “fast enough” for a large set of the most common use cases, and they can’t be beat for developer ergonomics (another important economic factor).
2
u/NoCap1435 Jul 02 '25
What a bullshit article. Take ruby and c++, solve same problem. Compare results regarding speed. Not all languages are fast, deal with it
5
u/BenchEmbarrassed7316 Jul 02 '25
This article is complete nonsense.
Usually writing code that should work, let alone not fast, but just normally in a slow language turns into torture. And the very simple, naive rewriting to a faster language immediately makes the code many times faster. For example, the TypeScript interpreter is being rewritten from TS to go (and the first is not the slowest and the second is not the fastest). Or remember the case of Discord when rewriting from go to Rust immediately gave a significant advantage due to the rejection of GC.
The author of the article generally has a strange attitude towards Rust as a low-level language, which is not at all the case: it is a fairly high-level language with many FP features.