My inaugural (http://www.russet.org.uk/blog/2968) book-review is for Clojure High Performance Programming, by Shantanu Kumar.

Unfortunately, for my first review, I cannot be that positive about the book. I found it rather disorganised and chaotic. Concepts are introduced and then briefly discussed, occasionally cross-referenced later. It is often not clear what the relevance of this to programming in Clojure. For instance, we are introduced to branch prediction in modern processors. Not something I know about, so perhaps useful to understand. But it’s not explained why this would be useful to know about. Are there any code examples that show how branch prediction can impact on the performance of my code? Likewise, different forms of CPU interconnect. Or L1,2 and 3 caches. I have the general impression that, as a Clojure programming I am a long way from the CPU; there is not really any sample code given showing how the size of the caches can really impact on my performance.

Worse those issues which can impact on the Clojure programmer are scantily covered. For example, the following (decompiled) java code is shown:

public Object invoke(Object x, Object y){
       x = null;
       y = null;
       return Numbers.multiply(x,y);
}

Partly, this demonstrates auto-boxing, but as a Java programmer, the code makes no sense, as it calls Numbers.multiple(null,null). It’s never explained how or why this makes sense (Clojure is clearing locals, something which works in byte-code, but cannot be translated into Java source). Type hinting (which I have just had the joy of adding to tawny-owl) is similarly dealt with in a little under 2 pages, despite having a potentially large impact on the performance of (some) Clojure libraries.

In short, as a series of vignettes about different aspects of performance it’s interesting enough; but the whole is no greater than the parts, and it left me with little increased knowlege of Clojure, nor how to make it perform well.

Bibliography

Leave a Reply