Clojure high performance programming
Subtitle: become an expert at writing fast and high performant code in Clojure 1.7.0
By: Shantanu Kumar
Edition: Second edition.
Series: Community experience distilled; Community experience distilled
Publisher: Packt Publishing
Published: 2015
Place of publication: Birmingham, UK
Language: eng
ISBN-13: 9781785287671; 9781785283642
Subjects: Clojure (Computer program language); Java virtual machine
Other titles: Become an expert at writing fast and high performant code in Clojure 1.7.0
Notes: Includes index.
Table of contents: title: Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Performance by Design; Use case classification; The user-facing software; Computational and data-processing tasks; A CPU bound computation; A memory bound task; A cache bound task; An input/output bound task; Online transaction processing; Online analytical processing; Batch processing; A structured approach to the performance; The performance vocabulary; Latency; Throughput; Bandwidth; Baseline and benchmark; Profiling; Performance optimization; title: Concurrency and parallelismResource utilization; Workload; The latency numbers that every programmer should know; Summary; Chapter 2: Clojure Abstractions; Non-numeric scalars and interning; Identity, value, and epochal time model; Variables and mutation; Collection types; Persistent data structures; Constructing lesser-used data structures; Complexity guarantee; O(<7) implies near constant time; The concatenation of persistent data structures; Sequences and laziness; Laziness; Laziness in data structure operations; Constructing lazy sequences; Transducers; Performance characteristics; title: TransientsFast repetition; Performance miscellanea; Disabling assertions in production; Destructuring; Recursion and tail-call optimization (TCO); Premature end of iteration; Multimethods versus protocols; Inlining; Summary; Chapter 3: Leaning on Java; Inspecting the equivalent Java source for Clojure code; Creating a new project; Compiling the Clojure sources into Java bytecode; Decompiling the .class files into Java source; Compiling the Clojure source without locals clearing; Numerics, boxing, and primitives; Arrays; Reflection and type hints; An array of primitives; Primitives; title: Macros and metadataString concatenation; Miscellaneous; Using array/numeric libraries for efficiency; HipHip; primitive-math; Detecting boxed math; Resorting to Java and native code; Proteus; title: mutable locals in Clojure; Summary; Chapter 4: Host Performance; The hardware; Processors; Branch prediction; Instruction scheduling; Threads and cores; Memory systems; Cache; Interconnect; Storage and networking; The Java Virtual Machine; The just-in-time compiler; Memory organization; HotSpot heap and garbage collection; Measuring memory (heap/stack) usage; Determining program workload type; title: Tackling memory inefficiencyMeasuring latency with Criterium; Criterium and Leiningen; Summary; Chapter 5: Concurrency; Low-level concurrency; Hardware memory barrier (fence) instructions; Java support and the Clojure equivalent; Atomic updates and state; Atomic updates in Java; Clojure's support for atomic updates; Faster writes with atom striping; Asynchronous agents and state; Asynchrony, queueing, and error handling; Why you should use agents; Nesting; Coordinated transactional ref and state; Ref characteristics; Ref history and in-transaction deref operations