ThoughtStorms Wiki

New page : ClojurePerformance

Quora Answer : Does Clojure have any performance benefits over Java?

Dec 4


Because of immutability a lot of things can be done by just copying pointers to, say, the head of a list or other complex data structure.

In Java you'd have had to make a deep copy because there would be a risk of one of the users of some data changing it.

That can't happen in Clojure.

Clojure's immutable data structures already take advantage of this to be efficient under the hood. And you can take advantage of that certainty that nothing is going to change the data when you don't want it to, in your own algorithms.

Your own algorithms are simpler to write because you don't have to think about the "what if someone else mutated this?" case. And can be faster because you never have to deep copy.

No Backlinks