Become an expert at writing fast and high performant code in Clojure 1.7.0
About This BookEnhance code performance by using appropriate Clojure featuresImprove the efficiency of applications and plan their deploymentA hands-on guide to designing Clojure programs to get the best performanceWho This Book Is ForThis book is intended for intermediate Clojure developers who are looking to get a good grip on achieving optimum performance. Having a basic knowledge of Java would be helpful.
What You Will LearnIdentify performance issues in Clojure programs using different profiling toolsMaster techniques to achieve numerical performance in ClojureUse Criterium library to measure latency of Clojure expressionsExploit Java features in Clojure code to enhance performanceAvoid reflection and boxing with type hintsUnderstand Clojure's concurrency and state-management primitives in depthMeasure and monitor performance, and understand optimization techniquesIn DetailClojure treats code as data and has a macro system. It focuses on programming with immutable values and explicit progression-of-time constructs, which are intended to facilitate the development of more robust programs, particularly multithreaded ones. It is built with performance, pragmatism, and simplicity in mind. Like most general purpose languages, various Clojure features have different performance characteristics that one should know in order to write high performance code.
This book shows you how to evaluate the performance implications of various Clojure abstractions, discover their underpinnings, and apply the right approach for optimum performance in real-world programs.
It starts by helping you classify various use cases and the need for them with respect to performance and analysis of various performance aspects. You will also learn the performance vocabulary that experts use throughout the world and discover various Clojure data structures, abstractions, and their performance characteristics. Further, the book will guide you through enhancing performance by using Java interoperability and JVM-specific features from Clojure. It also highlights the importance of using the right concurrent data structure and Java concurrency abstractions.
This book also sheds light on performance metrics for measuring, how to measure, and how to visualize and monitor the collected data. At the end of the book, you will learn to run a performance profiler, identify bottlenecks, tune performance, and refactor code to get a better performance.
Style and approachAn easy-to-follow guide full of real-world examples and self-sufficient code snippets that will help you get your hands dirty with high performance programming with Clojure.
The book packs plenty of information about performance, most of it quite generic, not really related to Clojure. At the same time, there are many tips about how to make Clojure programs faster. What feels wrong about this book is that the two sides (generic performance knowledge and Clojure tips) don't seem to follow each other or connect much. I wouldn't recommend this book for anything else but to get a general idea about performance optimizations.
The book is about... Clojure Performance. Yes, but wait. I summarize my impression of the book as a "quickly introduction" and "experience distilled" on "selected performance topics" with some "examples in Clojure when is possible" (with Java and the JVM themes obviously involved).
If you ever had read about "Queuing Theory", "Precomputing and Caching", "Performance Testing", "Profiling", you can read the book with the confidence that at some point you will learn something new or do some link with your path of learning and mastering Clojure. But if not, if you have never read more than 2 or 3 pages about any of the topics contained in this book (in average, the author only gives you less than a half page), probably you will be in the position of seeing it as a bunch of disconnected and subtle topics.
I really liked the book (I plan to read again some parts). The book have theory and it doesn't claims that Clojure itself is the key to success. The book try and try that you get the point entirely clear: you need analysis,design and measures to achieve high performance, it's a process, and it's in the details. The author have made a great effort to put side by side Clojure and Theory in order to achive Clojure High Performance. I liked it.
This book let you identify opportunities for optimization, for sure.
Why I give it 3,5 stars (rounded to 3 stars)? Because of the lack of:
- Deep explanations or more examples. All the topics has been explained quickly (really, in a rush) - A (good) bibliography for further references. - Did I mention it? A bibliography (This is a lack of authority to talk about anything, especially about "performance" and if you only give the reader an introduction on so many topics).
Short & dense book on performance optimization for Clojure. The book covers no only clojure/jvm-related optimizations, but also tries to give overview of what influence performance of the computer systems (cpu, caches, memory, etc.). It provides overview of JVM memory model & internals and gives some tips on how to optimize programs in Clojure, including tips on using type hinting, primitive types, arrays, etc. One chapter is completely dedicated to parallel/concurrent programming in Clojure & how it could be used to improve performance of the programs. Big advantage of the book is that it covers the Clojure 1.5 (including short description of reducers).
The main problem of the book, that not so many examples are given as an illustration to text - there are some sections that consist only from text (for example, about reducers) and if there were several examples added, the book would be much better. The examples of practical optimizations in existing libraries would be also very helpful.
I would recommend to look to this book for beginner developers, who only start to investigate the topic of performance optimization (not only in clojure)
Overall the book was pretty good. It provides interesting examples of real world Clojure code that solve specific performance problems. It talks about host performance, both JVM and hardware, concerns which are both areas that shouldn't be overlooked. I thought the book was best when showing examples of well performing code from libraries.
I'd recommend this book for developers who aren't past the beginning stages of writing performant code. It does a good job introducing the topics you'll want to think about when trying to craft well performing programs.
It isn't for the developer who has spent years optimizing code for performance. Those developers are already going to be familiar with the language and concerns of writing high performance code.