schedule Dec 15th 11:45 AM - 12:30 PM place Crystal 2 people 25 Interested

Haskell can and does perform as well as C, sometimes even better. However,
writing high performance software in Haskell is often challenging especially
because performance is sensitive to strictness, inlining and specialization.
This talk focuses on how to write high performance code using Haskell. It is
derived from practical experience writing high performance Haskell libraries. We
will go over some of the experiences from optimizing the "unicode-transforms"
library whose performance rivals the best C library for unicode normalization.
From more recent past, we will go over some learnings from optimizing and
benchmarking "streamly", a high performance concurrent streaming library. We
will discuss systematic approach towards performances improvement, pitfalls and
the tools of the trade.

 
7 favorite thumb_down thumb_up 0 comments visibility_off  Remove from Watchlist visibility  Add to Watchlist
 

Outline/structure of the Session

  1. Performance aspects of a Haskell Program
  2. Systematic approach to performance optimization
  3. Algorithmic, language agnostic optimizations vs language specific optimizations
  4. Basic performance optimizations and pitfalls - strictness, inlining and specialization
  5. Some advanced optimization techniques (e.g. rewrite rules/stream fusion)
  6. How to benchmark your code correctly
  7. Tools that help in measuring, debugging performance
  8. Case study - optimizing unicode-transforms
  9. Case study - optimizing streamly
  10. Lessons learned

Learning Outcome

After attending this talk, one should be able to understand how to write Haskell code for good performance, measure performance, identify bottlenecks, where to look first when there are performance problems, what tools to use, and how to approach optimizing for performance.

Target Audience

Anyone who wants to know and understand the performance aspects of a Haskell program, challenges involved in optimizing them.

Prerequisite

Basic knowledge of Haskell and its lazy evaluation model is required. Basics about GHC strictness annotations, inlining and specialization would help too.

schedule Submitted 5 months ago

Comments Subscribe to Comments

comment Comment on this Submission

  • Liked Michael Snoyman
    keyboard_arrow_down

    Michael Snoyman - Functional Programming for the Long Haul

    45 Mins
    Keynote
    Beginner

    How do you decide whether a programming language is worth using or not? By necessity, such decisions are usually based on assessments that can be made relatively quickly: the ease of using the language, how productive you feel in the first week, and so on. Unfortunately, this tells us very little about the costs involved in continuing to maintain a project past that initial phase. And in reality, the vast majority of time spent on most projects is spent in those later phases.

    I'm going to claim, based on my own experience and analysis of language features, that functional programming in general, and Haskell in particular, are well suited for improving this long tail of projects. We need languages and programming techniques that allow broad codebase refactorings, significant requirements changes, improving performance in hotspots of the code, and reduced debug time. I believe Haskell checks these boxes.

  • Liked Saurabh Nanda
    keyboard_arrow_down

    Saurabh Nanda - "Refresh-driven" development with Haskell & Elm

    Saurabh Nanda
    Saurabh Nanda
    Founder
    Vacation Labs
    schedule 5 months ago
    Sold Out!
    45 Mins
    Tutorial
    Beginner

    We sorely missed the rapid "refresh-based" feedback loop available in Rails (and other dynamically typed web frameworks), while writing Haskell. Change your code, hit save, and refresh your browser!

    In this talk we will share a few tips on how we finally hit productivity nirvana with ghcid and automated code-gen.

    Best of both worlds -- rock-solid type-safety AND being able to reload code with every change.

  • Liked Sudipta Mukherjee
    keyboard_arrow_down

    Sudipta Mukherjee - Creating DSLs in functional Kotlin

    Sudipta Mukherjee
    Sudipta Mukherjee
    Compiler Engineer
    Raincode Labs
    schedule 6 months ago
    Sold Out!
    45 Mins
    Demonstration
    Intermediate

    Domain Specific Languages (or Libraries because embedded DSLs are just that) are already quite popular.

    Modern languages have many useful language features that are conducive to create DSLs with more ease than ever before. Kotlin from JetBrains is a beautifully blended pragmatic programming language that packages many features from many programming languages. Kotlin also have infix operation which makes code written in a DSL made with Kotlin very easy to read (and therefore less error-prone).

    In this demonstration, I shall show couple DSLs made from Kotlin

    and will dissect the code LIVE to show audience how several language features in Kotlin (which sometimes requires playing with higher order functions) to develop these languages.

    *A Unit Testing DSL (a DSL to simplify unit testing of Kotlin, Java Code) that our grand/m/pa can use.

    -- All unit test frameworks serve the purpose but elegance is a different matter. A code that works, and a code that is elegant and works is art. In this example, audience will see how they can use several language features that Kotlin has to offer can be put together to create an elegant and expandable unit testing DSL.

    * A DSL for Web Scraping and Transformation.

    - - A special case of ETL, where Extraction happens from raw HTML, Transformation happens in memory using the DSL designed. and the Load happens by loading this data to a different schema/db/form/representation.

  • Liked Raghu Ugare
    keyboard_arrow_down

    Raghu Ugare / Vijay Anant - (Why) Should You know Category Theory ?

    45 Mins
    Talk
    Intermediate

    Category Theory has been found to have a vast field of applications not limited to programming alone.

    In this fun-filled talk (Yes! We promise!) , we want to make the audience fall in love with Math & Category Theory in general, and Haskell in particular.

    We will address questions such as below:

    • What is the mysterious link between the abstract mathematical field of Category Theory and the concrete world of real-world Programming ? And why is it relevant especially in Functional Programming?
    • Most of all, how can You benefit knowing Category Theory ? (Examples in Haskell)

  • Liked Tony Morris
    keyboard_arrow_down

    Tony Morris - Parametricity, Functional Programming, Types

    45 Mins
    Talk
    Intermediate

    In this talk, we define the principle of functional programming, then go into
    detail about what becomes possible by following this principle. In particular,
    parametricity (Wadler, 1989) and exploiting types in API design are an essential
    property of productive software teams, especially teams composed of volunteers
    as in open-source. This will be demonstrated.

    Some of our most important programming tools are neglected, often argued away
    under a false compromise. Why then, are functional programming and associated
    consequences such as parametricity so casually disregarded? Are they truly so
    unimportant? In this talk, these questions are answered thoroughly and without
    compromise.

    We will define the principle of functional programming, then go into
    detail about common problems to all of software development. We will build the
    case from ground up and finish with detailed practical demonstration of a
    solution to these problems. The audience should expect to walk away with a
    principled understanding and vocabulary of why functional programming and
    associated techniques have become necessary to software development.

  • Liked Michael Ho
    keyboard_arrow_down

    Michael Ho - Making the Switch: How We Transitioned from Java to Haskell

    Michael Ho
    Michael Ho
    Sr. Software Engineer
    SumAll
    schedule 5 months ago
    Sold Out!
    45 Mins
    Case Study
    Intermediate

    In this case study presentation, SumAll's CTO, Todd Sundsted, and Senior Software Engineer, Michael Ho, will discuss the move from Java to Haskell along two parallel paths. First, the business/political story — how SumAll convinced the decision makers, fought the nay-sayers, and generally managed the people impacted by the transition. Second, the technical story — how they actually replaced their Java code with Haskell code. Along the way, they will address their hopes and expectations from transitioning from Java to Haskell, and will conclude with the results they've gained and seen to date.

  • Liked Anupam Jain
    keyboard_arrow_down

    Anupam Jain - Purely Functional User Interfaces that Scale

    Anupam Jain
    Anupam Jain
    Haskell Consultant
    S&P Global
    schedule 5 months ago
    Sold Out!
    45 Mins
    Talk
    Beginner

    A virtual cottage industry has sprung up around Purely functional UI development, with many available libraries that are essentially just variants on two distinct approaches: Functional Reactive Programming (FRP), and some form of functional views like "The Elm Architecture". After having worked extensively with each of them, I have found that none of the approaches scale with program complexity. Either they are too difficult for beginners trying to build a hello world app, or they have unpredictable complexity curves with some simple refactorings becoming unmanageably complex, or they "tackle" the scaling problem by restricting developers to a safe subset of FP which becomes painful for experienced developers who start hitting the complexity ceiling.

    In this talk I give an overview of the current Purely Functional UI Development Landscape, and then present "Concur", a rather unusual UI framework, that I built to address the shortcomings of the existing approaches. In particular, it completely separates monoidal composition in "space" (i.e. on the UI screen), from composition in "time" (i.e. state transitions), which leads to several benefits. It's also a general purpose approach, with Haskell and Purescript implementations available currently, and can be used to build user interfaces for the web or for native platforms.

    The biggest advantage of Concur that has emerged is its consistent UI development experience that scales linearly with program complexity. Simple things are easy, complex things are just as complex as the problem itself, no more. Reusing existing widgets, and refactoring existing code is easy and predictable. This means that Concur is suitable for all levels of experience.

    1. For Learners - Concur provides a consistent set of tools which can be combined in predictable ways to accomplish any level of functionality. Due to its extremely gentle learning curve, Concur is well suited for learners of functional programming (replacing console applications for learners).
    2. For experienced folks - Assuming you are already familiar with functional programming, Concur will provide a satisfying development experience. Concur does not artificially constrain you in any form. You are encouraged to use your FP bag of tricks in predictable ways, and you are never going against the grain. It's a library in spirit, rather than a framework.
  • Liked George Wilson
    keyboard_arrow_down

    George Wilson - Laws!

    45 Mins
    Talk
    Beginner

    Laws, laws, laws. It seems as though whenever we learn about a new abstraction in functional programming, we hear about its associated laws. Laws come up when we learn about type classes like Functors, Monoids, Monads, and more! Usually laws are mentioned and swiftly brushed past as we move on to examples and applications of whatever structure we're learning about. But not today.

    In this talk, we'll learn about Functors and Monoids, paying close attention to their laws. Why should our abstractions have laws? We'll answer this question both by seeing powers we gain by having laws, and by seeing tragedies that can befall us without laws.

  • Liked Michael Snoyman
    keyboard_arrow_down

    Michael Snoyman - Applied Haskell Workshop

    Michael Snoyman
    Michael Snoyman
    Vice President of Engineering
    FP Complete
    schedule 6 months ago
    Sold Out!
    480 Mins
    Workshop
    Intermediate

    This full day workshop will focus on applying Haskell to normal, everyday programming. We'll be focusing on getting comfortable with common tasks, libraries, and paradigms, including:

    • Understanding strictness, laziness, and evaluation
    • Data structures
    • Structuring applications
    • Concurrency and mutability
    • Library recommendations

    By the end of the workshop, you should feel confident in working on production Haskell codebases. While we obviously cannot cover all topics in Haskell in one day, the goal is to empower attendees with sufficient knowledge to continue developing their Haskell skillset through writing real applications.

  • Liked Tanmai Gopal
    keyboard_arrow_down

    Tanmai Gopal - Using Haskell to build a performant GraphQL to SQL compiler

    Tanmai Gopal
    Tanmai Gopal
    Founder
    Hasura
    schedule 4 months ago
    Sold Out!
    45 Mins
    Case Study
    Intermediate
    1. Motivation/Problem statement: Lifecycle of a GraphQL query
    2. Design Goals
    3. Why Haskell
    4. Compiler implementation details:
      1. Fast GraphQL parsing with parser combinators
      2. Modelling and manipulating the GraphQL AST with algebraic data types
      3. Software Transactional Memory: Concurrency constructs for scaling GraphQL subscriptions
    5. Summary with performance benchmarks
  • Liked Zubin Duggal
    keyboard_arrow_down

    Zubin Duggal - The Future of Haskell Tooling

    20 Mins
    Talk
    Intermediate

    Haskell tooling, particularly editor and IDE integration has been sorely lacking for years. This talk will be a broad overview of the state of Haskell tooling, and the challenges faced by it. It will be derived from the experience of working on two summer of code projects trying to improve Haskell tooling.

    For tooling users, we will discuss different Haskell tools available today(intero, haskell-ide-engine, ghcid etc.), their differences and trade-offs with respect to build tool support(stack, cabal, new-build, nix, make etc.), editor integration, features, limitations and speed.

    We will go over the approach taken by haskell-ide-engine and the Language Server Protocol in order to solve these problems. Then we will discuss the new .hie file format designed to make information about Haskell source collected by GHC more accessible to tooling and users.

    Finally, for budding tooling writers, we will discuss the various approaches to writing programs that extract information from and manipulate Haskell source, and their pros and cons:

    • The GHC API
      • Via ghc-mod and haskell-ide-engine
    • ghc-exactprint
    • haskell-src-extras
    • GHC source plugins
    • .hie files
  • Liked Ravi Mohan
    keyboard_arrow_down

    Ravi Mohan - Experience Report: Building Shin - A Typed Functional Compiler For Computational Linear Algebra Problems.

    Ravi Mohan
    Ravi Mohan
    CEO
    AxiomChoice
    schedule 6 months ago
    Sold Out!
    45 Mins
    Talk
    Intermediate

    Abstract: I wrote a distributed (mostly) Functional Compiler in Scheme, OCaml and Elixir that incorporates knowledge of Computational Linear Algebra and domain specific knowledge to generate highly optimized linear algebra code from specification of problems. This talk is about lessons learned in the process.

    The problem:
    In every domain that uses computational linear algebra (which is all of engineering and science), we encounter the 'how to optimize a linear algebra expression into an optimized sequence of BLAS (or LAPACK or $linear_algera library) kernel calls' problem.

    Example: (if the math equations make you want to tear your hair out and go jump off a cliff, don't worry, it is just an example, you don't have to grok it. Just skim the equations The basic problem being addressed here is that solving such equations with code takes up a lot of effort and time from experts in computational linear algebra)


    Here is a linear algebra expression from a genetics problem , specifically GWAS -Genome Wide Association Studies, looking for significant associations for millions of genetic markers- where the essence of the problem [1] comes down to generating the most efficient algorithm possible that solves these equations

    This in turn involves solving a 2 dimensional sequence of Generalized Least Squared Problems of the form

    The algorithms to solve these can be directly coded up in Matlab or Julia. But there are problems with this approach, with this specific problem.


    1. For different input sizes, different algorithms give the most optimal performance. Which algorithm do you code up?


    2. Even for a given input size, there are multiple algorithms that compute the same result, but have differing computational characteristics depending on the hardware etc. How do you generate the optimal algorithm for your hardware ?


    3. Most importantly the structure of *this* specific problem allows optimizations that are specific to the problem which are not built into generic linear algebra routines. (Obviously, one can't expect MATLAB to incorporate problem specific information for every scientific/engineering problem ever). The GLS problems are connected to others, thus saving intermediate results can save hours of computation vs calculating every GLS problem from scratch

    In practice, one needs to be an expert in Computational Linear Algebra to come up with the optimized algorithm for a domain specific problem, and then write (say Fortran) code to use BLAS, LAPACK etc optimally to actualize this algorithm, often with much iteration, often consuming 100s of hours.

    The Solution:


    Incorporating this 'expert knowledge' into a compiler speeds up the time taken to arrive at the best solution (often by a factor of 100 or 1000), and allows Computational Linear Algebra experts to do more interesting things, like focus on their research.

    For this particular problem, the above equations, and additional knowledge of the problem domain are the input into an expression compiler. The output is highly efficient and 'proved correct' code

    In compiler terms, incorporating domain knowldege into the compilation process results in being able to apply optimizations to the generated Syntax Trees/Graphs, resulting in optimal algorithms. (note: the output of the compiler is a program in another language- say Matlab).

    In essence, "Domain Specific Compilers" consume knowledge about the structure of a problem and generate optimized code that solves that problem.

    Shin is one such compiler. It consumes a problem description and outputs highly efficient Julia code that solves the problem.

    This talk focuses on the engineering challenges I faced in building this compiler, with a special focus on the approaches that failed [5]

    Trivia:

    "Shin" is the Hebrew letter, not the English word meaning 'front of the leg between knee and ankle' ;-).

    Every company uses names from a common theme to name their servers and components - Athena, Zeus, Hercules , or Thor, Loki, Odin, or Jedi, Sith, Skywalker etc. We use Hebrew words, so we have Ruach, Melekh, Malkuth etc..

  • Liked Sean Chalmers
    keyboard_arrow_down

    Sean Chalmers - Condensed Applied FP Course

    480 Mins
    Workshop
    Intermediate

    Intermediate functional programmers often find it daunting to move from examples provided in books and blogs to developing their first fully functioning application. The Queensland Functional Programming Lab at Data61/CSIRO have produced a course for exactly this purpose. Building on the fundamentals, we work through the process of constructing a REST application covering the following topics:

    • Package dependencies
    • Project configuration
    • Application testing & building
    • Encoding / decoding messages
    • Persistent storage integration
    • App state & configuration management
    • Error handling & reporting

  • Liked Emily Pillmore
    keyboard_arrow_down

    Emily Pillmore - A Radically New Functional Blockchain Architecture: Chainweb

    Emily Pillmore
    Emily Pillmore
    Haskell Engineer
    Kadena.io
    schedule 5 months ago
    Sold Out!
    45 Mins
    Talk
    Advanced

    Proof-of-work blockchain networks like Bitcoin, Litecoin and Ethereum are characterized by low throughput (5-15 transactions per second). Efforts to improve throughput through protocol modifications, such as block size increases, have no hope of reaching levels required to take on modern fiat-currency payment networks. However, efforts that seek to replace Proof-of-Work (Proof-of-Stake and variants) or integrate it with off-chain networks and processes (payment channels, side chains) degrade assurance, censorship resistance or trustless-ness of the original design. Recovering and elaborating on early proposals for Bitcoin scaling, we present ChainWeb, a parallel-chain architecture which can combine hundreds to thousands of Proof-of-Work blockchains pushing throughput to 10,000 transactions per second and beyond. The network transacts a single currency, using atomic and trustless SPV (Simple Payment Verification) cross-chain transfers orchestrated at the application layer with capability and coroutine support in the Pact smart contract language. Chains incorporate each other’s Merkle tree receipts to enforce a single “super branch” offering an effective hash power that is the sum of each individual chain’s hash rate. In addition to massive throughput, other benefits accrue from having a truly parallelized smart-contract blockchain system.

  • Liked Andrew McCluskey
    keyboard_arrow_down

    Andrew McCluskey - Property-based State Machine Testing

    45 Mins
    Talk
    Intermediate

    Automated testing is key to ensuring the ongoing health and well-being of any software project,giving developers and users confidence that their software works as intended. Property based testing is a significant step forward compared to traditional unit tests, exercising code with randomly generated inputs to ensure that key properties hold. However, both of these techniques tend to be used at the level of individual functions. Many important properties of an application only appear at a higher level, and depend on the state of the application under test. The Haskell library hedgehog, a relative newcomer to the property based testing world, includes facilities for property-based state machine testing, giving developers a foundation on which to build these more complicated tests.

    In this talk, Andrew will give you an introduction to state machine property testing using hedgehog. He'll start with a quick refresher on property based testing, followed by a brief introduction to state machines and the sorts of applications they can be used to model. From there, he'll take you on a guided tour of hedgehog's state machine testing facilities. Finally, Andrew will present a series of examples to show off what you can do and hopefully give you enough ideas to start applying this tool to your own projects. The first set of examples will test a web application written in Haskell. These tests will include: content creation and deletion, uniqueness constraints, authentication, and concurrent transactions. A second set of examples will test an application written in a language other than Haskell to demonstrate that this technique is not limited to applications written in Haskell.

    An intermediate knowledge of Haskell and familiarity with property based testing will be beneficial,but not essential. The slides and demo application will be available after the talk for people to study in detail.

  • Liked Emily Pillmore
    keyboard_arrow_down

    Emily Pillmore - Pact: An Open Source Language for Smart Contracts

    Emily Pillmore
    Emily Pillmore
    Haskell Engineer
    Kadena.io
    schedule 5 months ago
    Sold Out!
    45 Mins
    Demonstration
    Intermediate

    In this talk we'll discuss the design and implementation of a smart contract property verification tool for Pact.

    The revolutionary idea of putting computer programs in a blockchain to create smart contracts has opened up a whole new world of possibilities. But these programs have very different characteristics from other software. This talk explores these differences, some of the challenges that have been encountered, and then discusses how Kadena is solving these problems with its smart contract language Pact. We'll discuss the design and implementation of a smart contract property verification tool for Pact. We leverage these (lack of) features to build a system capable of proving many properties of contracts via the Z3 SMT solver. We'll also give examples of real bugs caught by the system.

  • Liked Harendra Kumar
    keyboard_arrow_down

    Harendra Kumar - Streamly: Declarative Concurrency and Dataflow Programming in Haskell

    45 Mins
    Talk
    Intermediate

    Streamly is a Haskell library that marries monadic streaming and concurrency
    providing an elegant way of doing declarative concurrent dataflow programming.
    The Haskell ecosystem has some fine streaming libraries like pipes and conduit.
    However, these libraries are inherently serial and provide no support for
    concurrency within the streaming framework. Streamly is the first ever haskell
    streaming library that defines and implements concurrency semantics within
    a monadic streaming framework.

    The streaming API of Streamly is surprisingly simple, it is almost the same as
    standard Haskell lists, therefore, programmers do not need to learn a new DSL.
    By using specific concurrency-style combinators, streams can be generated,
    merged, chained, mapped, zipped, and consumed concurrently. Imagine your
    program as a pipeline of queues composed in a combination of serial and
    parallel configurations, and you can easily control which of these queues to
    run concurrently and at what rate. The degree of concurrency is auto scaled
    based on the feedback from the stream consumer, or based on a programmer
    specified rate limit. Moreover, Streamly does not trade performance with high
    level declarative concurrency, it provides excellent non-concurrent and
    concurrent performance.

  • Liked Ram Dayal Vaishnav
    keyboard_arrow_down

    Ram Dayal Vaishnav - WebVR for creating immersive Virtual Reality experience

    Ram Dayal Vaishnav
    Ram Dayal Vaishnav
    Sr. Software Engineer
    Arcesium
    schedule 7 months ago
    Sold Out!
    45 Mins
    Demonstration
    Beginner

    Have you noticed that the development of Virtual Reality experiences has started a major makeover of the computer industry? I believe that Virtual Reality is going to become a primary platform soon, which will completely change the way we work, play and communicate digitally. The Web, being the most open platform, is now a key participant for providing cool Virtual Reality experiences. I would love to talk about Building Virtual Reality websites using A-Frame in this version of FunctionalConf.

    A-Frame is an open-source web framework by Mozilla for easily creating VR experiences using WebVR which work on all platforms. In this session, audience will learn to use various concepts & APIs of A-Frame through demos and live coding few WebVR scenes. With this, you will be able to create interactive and immersive VR websites on the web. A-Frame has incorporated functional programming in various ways, one such implementation was discussed in https://github.com/aframevr/aframe/issues/2012. I will talk about few of these functional programming related aspects related to A-Frame.

    This session will also cover following:

    - How A-Frame is different from ReactVR
    - Keys to make your VR website to have immersive experience
    - How can one get involved with the A-Frame community to contribute in its development.
    - Step by step example towards how a piece of code can be shifted towards being functional in A-Frame.

  • Liked Neeraj Sharma
    keyboard_arrow_down

    Neeraj Sharma - BeamParticle - A Polyglot Dynamic Programming Engine

    Neeraj Sharma
    Neeraj Sharma
    Director Engineering
    redBus
    schedule 5 months ago
    Sold Out!
    90 Mins
    Tutorial
    Intermediate

    BeamParticle is an open source project built on top of the Erlang virtual machine (BEAM), which allows dynamic (re)programming in multiple programming languages. This project tries to take some simple decisions thereby making the life of developer easy in realizing dynamic code patching and reprogrammability. It is very easy to setup this software on any of the modern GNU/Linux distributions, although Debian packages are available for Ubuntu Xenial. The project supports six different programming languages; namely: Erlang, Elixir, Java, Python, Efene, and PHP.

    The system is deployed in a limited capacity in production within redBus to serve numerous use cases.

  • Liked Ankit Rokde
    keyboard_arrow_down

    Ankit Rokde - My Haskell Program does not fail. Proof?

    Ankit Rokde
    Ankit Rokde
    Student
    IIT Bombay
    schedule 5 months ago
    Sold Out!
    20 Mins
    Talk
    Intermediate

    Proving correctness of programs and ensuring they are bug-free has always been a challenging problem.

    Mostly we have relied on manual testing to check the correctness of programs.

    Strong static type systems help us to write bug free programs from the start but many interesting cases can miss out.

    Many tools such as QuickCheck, Liquid Haskell have been developed to address this issue.

    In this talk, we will presenting a different approach, Bounded Model Checking (BMC), which has been very successful in proving correctness of imperative programs by means of tools such as CBMC.

    We will explain how BMC works at high level, how we have adopted it for Haskell and our success with the same.

    We will also present how you can use it to prove correctness of your Haskell programs.