Hiding Performance Optimizations

Now that we’ve proven a particular bit of code is really too slow, what can we do to make it faster? Shantanu Kumar’s Clojure High Performance Programming [Kum13] is full of techniques to improve the performance of Clojure programs and we touch upon two tricks in this chapter. Often these techniques mean embracing the wonderful Java interop of Clojure, using primitives, arrays, and type hinting to match Java performance. However, a codebase packed with features like these can make Clojure feel like Java, which can be shocking for a functional programming devotee. Let’s look at how we can speed things up without winding up with ugly, unreadable code.

Imagine you’ve been working on a feature for one of your back-office ...

Get Mastering Clojure Macros now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.