Clojure High Performance Programming - Second Edition

Become an expert at writing fast and high performant code in Clojure 1.7.0

Clojure High Performance Programming - Second Edition

This ebook is included in a Mapt subscription
Shantanu Kumar

1 customer reviews
Become an expert at writing fast and high performant code in Clojure 1.7.0
$27.99
$34.99
RRP $27.99
RRP $34.99
eBook
Print + eBook
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find out moreStart Free Trial
 
Code Files
Preview in Mapt

Book Details

ISBN 139781785283642
Paperback198 pages

Book Description

Clojure 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.

Table of Contents

Chapter 1: Performance by Design
Use case classification
A structured approach to the performance
The performance vocabulary
The latency numbers that every programmer should know
Summary
Chapter 2: Clojure Abstractions
Non-numeric scalars and interning
Identity, value, and epochal time model
Persistent data structures
Sequences and laziness
Transducers
Transients
Performance miscellanea
Summary
Chapter 3: Leaning on Java
Inspecting the equivalent Java source for Clojure code
Numerics, boxing, and primitives
Arrays
Reflection and type hints
Using array/numeric libraries for efficiency
Resorting to Java and native code
Summary
Chapter 4: Host Performance
The hardware
The Java Virtual Machine
Measuring latency with Criterium
Summary
Chapter 5: Concurrency
Low-level concurrency
Atomic updates and state
Asynchronous agents and state
Coordinated transactional ref and state
Dynamic var binding and state
Validating and watching the reference types
Java concurrent data structures
Concurrency with threads
Clojure parallelization and the JVM
Parallelism with reducers
Summary
Chapter 6: Measuring Performance
Performance measurement and statistics
Performance testing
Performance monitoring
Profiling
Summary
Chapter 7: Performance Optimization
Project setup
Identifying performance bottlenecks
Profiling code with VisualVM
The Monitor tab
Performance tuning
Summary
Chapter 8: Application Performance
Choosing libraries
Logging
Data sizing
Resource pooling
I/O batching and throttling
Precomputing and caching
Concurrent pipelines
Applying back pressure
Performance and queueing theory
Summary

What You Will Learn

  • Identify performance issues in Clojure programs using different profiling tools
  • Master techniques to achieve numerical performance in Clojure
  • Use Criterium library to measure latency of Clojure expressions
  • Exploit Java features in Clojure code to enhance performance
  • Avoid reflection and boxing with type hints
  • Understand Clojure's concurrency and state-management primitives in depth
  • Measure and monitor performance, and understand optimization techniques

Authors

Table of Contents

Chapter 1: Performance by Design
Use case classification
A structured approach to the performance
The performance vocabulary
The latency numbers that every programmer should know
Summary
Chapter 2: Clojure Abstractions
Non-numeric scalars and interning
Identity, value, and epochal time model
Persistent data structures
Sequences and laziness
Transducers
Transients
Performance miscellanea
Summary
Chapter 3: Leaning on Java
Inspecting the equivalent Java source for Clojure code
Numerics, boxing, and primitives
Arrays
Reflection and type hints
Using array/numeric libraries for efficiency
Resorting to Java and native code
Summary
Chapter 4: Host Performance
The hardware
The Java Virtual Machine
Measuring latency with Criterium
Summary
Chapter 5: Concurrency
Low-level concurrency
Atomic updates and state
Asynchronous agents and state
Coordinated transactional ref and state
Dynamic var binding and state
Validating and watching the reference types
Java concurrent data structures
Concurrency with threads
Clojure parallelization and the JVM
Parallelism with reducers
Summary
Chapter 6: Measuring Performance
Performance measurement and statistics
Performance testing
Performance monitoring
Profiling
Summary
Chapter 7: Performance Optimization
Project setup
Identifying performance bottlenecks
Profiling code with VisualVM
The Monitor tab
Performance tuning
Summary
Chapter 8: Application Performance
Choosing libraries
Logging
Data sizing
Resource pooling
I/O batching and throttling
Precomputing and caching
Concurrent pipelines
Applying back pressure
Performance and queueing theory
Summary

Book Details

ISBN 139781785283642
Paperback198 pages
Read More
From 1 reviews

Read More Reviews