Haskell High Performance Programming
By Samuli Thomasson
Publisher: Packt Publishing
Final Release Date: September 2016
Pages: 408

Boost the performance of your Haskell applications using optimization, concurrency, and parallel programming

About This Book

  • Explore the benefits of lazy evaluation, compiler features, and tools and libraries designed for high performance
  • Write fast programs at extremely high levels of abstraction
  • Work through practical examples that will help you address the challenges of writing efficient code

Who This Book Is For

To get the most out of this book, you need to have a working knowledge of reading and writing basic Haskell. No knowledge of performance, optimization, or concurrency is required.

What You Will Learn

  • Program idiomatic Haskell that's also surprisingly efficient
  • Improve performance of your code with data parallelism, inlining, and strictness annotations
  • Profile your programs to identify space leaks and missed opportunities for optimization
  • Find out how to choose the most efficient data and control structures
  • Optimize the Glasgow Haskell Compiler and runtime system for specific programs
  • See how to smoothly drop to lower abstractions wherever necessary
  • Execute programming for the GPU with Accelerate
  • Implement programming to easily scale to the cloud with Cloud Haskell

In Detail

Haskell, with its power to optimize the code and its high performance, is a natural candidate for high performance programming. It is especially well suited to stacking abstractions high with a relatively low performance cost. This book addresses the challenges of writing efficient code with lazy evaluation and techniques often used to optimize the performance of Haskell programs.

We open with an in-depth look at the evaluation of Haskell expressions and discuss optimization and benchmarking. You will learn to use parallelism and we'll explore the concept of streaming. We'll demonstrate the benefits of running multithreaded and concurrent applications. Next we'll guide you through various profiling tools that will help you identify performance issues in your program. We'll end our journey by looking at GPGPU, Cloud and Functional Reactive Programming in Haskell. At the very end there is a catalogue of robust library recommendations with code samples.

By the end of the book, you will be able to boost the performance of any app and prepare it to stand up to real-world punishment.

Style and approach

This easy-to-follow guide teaches new practices and techniques to optimize your code, and then moves towards more advanced ways to effectively write efficient Haskell code. Small and simple practical examples will help you test the concepts yourself, and you will be able to easily adapt them for any application.

Product Details
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyHaskell High Performance Programming
 
4.0

(based on 1 review)

Ratings Distribution

  • 5 Stars

     

    (0)

  • 4 Stars

     

    (1)

  • 3 Stars

     

    (0)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

Reviewed by 1 customer

Displaying review 1

Back to top

 
4.0

Broad look at writing performant software in modern Haskell

By Aaron Stevens

from Little Rock, AR

Verified Reviewer

Pros

  • Covers A Lot Of Ground
  • Great Profiling Tips

Cons

  • Too basic
  • Too Shallow In Places

Best Uses

    Comments about oreilly Haskell High Performance Programming:

    Overall I really liked this book, I think that it covers a good number of topics to really introduce the reader to writing high performance applications in Haskell. The first several chapters of the book are really solid, they go into a good amount of detail in choosing data structures wisely, the use cases for lazy and strict values, and profiling code in a variety of ways. Many of the techniques shown are hard to find covered elsewhere, particularly in configuring GHC and other tools to get useful information. I personally hadn't even seen the ekg live profiling tool before, it looks like a very powerful tool that I'll be adding to my projects in the future.

    I know I'll be coming back to this book for examples on profiling Haskell code with GHC, though. While there is documentation for the various compiler and runtime flags for GHC, knowing which ones to use, and more importantly how to use them, is something that doesn't show up in many blog posts, tutorials, or other texts. It's also more up-to-date than other Haskell books, such as Real World Haskell and Learn You a Haskell, a big plus for beginners who are using GHC 7.10 or newer.

    The chapters on parallelism and concurrency is pretty good at covering the basics, but the Parallel and Concurrent Programming in Haskell book by Simon Marlow would still be my first resource on this subject (it's hard to compare a couple chapters to an entire book!).

    That being said, towards the end of the book some of the chapters really turned into quick overviews and I felt missed out on the opportunity to show a lot of detail that's hard to find elsewhere. In particular, I think topics like Repa and Accelerate need more involved examples to really show how they can be useful. I know it's difficult to build these examples for a wide audience, but I've seen success with it in other spaces like Python and NumPy. The chapters on Cloud Haskell and FRP also had this feel, it just didn't cover these topics deeply enough for me. The last chapter is on library recommendations for which this is appropriate, it just felt more like all of those chapters could have been combined into one.

    My final verdict is that this is a useful book for a lot of people. Even if you've been using Haskell for a long time there are probably some pieces of new information in here, particularly with profiling techniques. The low level details of GHC can also help people understand what is actually going on when your code is compiled, and how seemingly small changes can have major impacts on performance.

    I received a copy of this book and compensation from the publisher for my role as the technical reviewer of this book.

    Displaying review 1

    Back to top

     
    Buy 2 Get 1 Free Free Shipping Guarantee
    Buying Options
    Immediate Access - Go Digital what's this?
    Ebook:  $39.99
    Formats:  ePub, Mobi, PDF