On Clojure High Performance Programming

So I was going through the book Clojure High Performance Programming and I thought I might share a line or two about why I think this book is a good read.

First, this really isn’t just a book of recipes for writing faster Clojure programs by only exploiting what the standard library or 3rd party libraries have to offer. What I like about this book in general is the back-to-the-basics approach. You don’t start with Clojure internals, you don’t even start with JVM internals. Not even the OS. You start with bare metal. Getting to know (or refreshing the knowledge of) how CPUs work, how they interact with the RAM, where are the usual bottlenecks. Well, these things actually aren’t covered right at the beginning of the book (which baffled me a bit) but you start getting the global picture once you go through them.

Other than that the book offers a good intro into the performance characteristics of persistent data structures in Clojure (yes, all the big-O stuff included) or how numerics in Clojure work and what is their relationship to the underlying Java implementations. A lot of interesting snippets showing not-that-well-known or darker corners of the Clojure language. Very important part of the book is the one on Clojure concurrency primitives - atoms, agents, refs - as these can be real bottlenecks when used improperly. You also get to know Clojure’s explicit parallelization features, like parallel mapping or reducers and all that stuff.

There is a lot of things this book goes over, sometimes only glossing over. Some might (or actually do) think that this is the biggest drawback of the book. But to me this isn’t a problem - on the contrary. All the things motivate me to fire up Google and start studying more on what might not be exactly a deep dive in right in the book.

A few days after starting with this book I actually found myself having it open next to my Clojure dev setup and consulting it when doing real Clojure development. Not because it is an exhaustive text on Clojure performance (it isn’t, of course - and doesn’t aim to be). Simply just because it’s a good “catapult” for exploring more on all the important performance themes in the Clojure programming story.



view archive

Ask me anything