New year, new library releases, new levels of speed

I just released new versions of the Haskell text, attoparsec, and aeson libraries on Hackage, and there’s a surprising amount to look forward to in them. The summary for the impatient: some core operations in text and aeson are now much more efficient. With text, UTF-8 encoding is up to four times faster, while with aeson, encoding and decoding of JSON bytestrings are both up to twice as fast. attoparsec 0.11.1.0 Perhaps the least interesting release is attoparsec. It adds a new dependency on Bas Van Dijk’s scientific package to allow efficient and more accurate parsing of floating point numbers, a longstanding minor weakness. It also introduces two new functions for single-token lookahead, which are used by the new release of aeson; read on for more details. ...

9 January 2014 · 3 min · Bryan O'Sullivan

Testing a UTF-8 decoder with vigour

Yesterday, Michael Snoyman reported a surprising regression in version 1.0 of my Haskell text library: for some invalid inputs, the UTF-8 decoder was truncating the invalid data instead of throwing an exception. Thanks to Michael providing an easy repro, I quickly bisected the origin of the regression to a commit from September that added support for incremental decoding of UTF-8. That work was motivated by applications that need to be able to consume incomplete input (e.g. a network packet containing possibly truncated data) as early as possible. ...

31 December 2013 · 8 min · Bryan O'Sullivan

Open question: help me design a new encoding API for aeson

For a while now, I’ve had it in mind to improve the encoding performance of my Haskell JSON package, aeson. Over the weekend, I went from hazy notion to a proof of concept for what I think could be a reasonable approach. This post is a case of me “thinking out loud” about the initial design I came up with. I’m very interested in hearing if you have a cleaner idea. ...

15 October 2013 · 5 min · Bryan O'Sullivan

Big fucking deal

Quoth Wikipedia: Big data[1][2] is a collection of data sets so large and complex that it becomes difficult to process using on-hand database management tools or traditional data processing applications. The challenges include capture, curation, storage,[3] search, sharing, transfer, analysis,[4] and visualization. The trend to larger data sets is due to the additional information derivable from analysis of a single large set of related data, as compared to separate smaller sets with the same total amount of data, allowing correlations to be found to “spot business trends, determine quality of research, prevent diseases, link legal citations, combat crime, and determine real-time roadway traffic conditions.” Now what if we get tired of the current hype cycle? ...

1 May 2013 · 2 min · Bryan O'Sullivan

What’s in a number? criterion edition

[Edit: a few hours after I wrote this post, I wrote some code to get rid of the inflation phenomenon it describes, and I’ll publish a corresponding update to criterion shortly. See below for details, and the bottom for a new chart that shows the effect of the fix.] A couple of days ago, Alexey Khudyakov did a little digging into the accuracy of criterion’s measurements. I thought his results were interesting enough to be worth some deeper analysis. ...

14 April 2013 · 4 min · Bryan O'Sullivan

What’s good for C++ is good for … Haskell!?

A few days ago, my Facebook colleague Andrei Alexandrescu posted a note entitled Three Optimization Tips for C++, which reminded me that I had unfinished business with Haskell’s text package. I took his code, applied it to the text package, and this is the story of what happened. The text package provides a type named Builder for efficiently constructing Unicode strings from smaller fragments. A couple of years after Johan contributed the initial Builder implementation, I wrote some helper functions to perform recurring tasks, such as rendering numbers. ...

20 March 2013 · 6 min · Bryan O'Sullivan

A major new release of the Haskell hashable library

I have spent quite some time over the last couple of months improving the Haskell hashable library, and all of my efforts eventually turned into a near-complete rewrite of the library. The 1.2 release of hashable is not backwards compatible, and for several good reasons. Read on for the details. Hash flooding The threat landscape faced by applications that use hash-based data structures has shifted radically this year, with hash flooding emerging as an attack vector after a long period of obscurity (the earliest publication I know of on the subject dates back to 1998, but I doubt that it was new even then). ...

14 December 2012 · 4 min · Bryan O'Sullivan

A fast new SipHash implementation in Haskell

I’ve recently been talking with Johan Tibell about submitting his hashable package to become a part of the Haskell Platform. Once we get that submission accepted, we can fold Johan’s excellent hash-based data structures from his unordered-containers package into the standard containers package. For many applications, the hash array mapped tries in unordered-containers offer a decent performance advantage over the current standard of ordered search trees. Prior to making the submission, I found myself wanting to spring clean the hashable package. Although it is simple and well put together, it has some robustness problems that are important in practice. ...

2 October 2012 · 4 min · Bryan O'Sullivan

The case of the mysterious explosion in space

The case of the mysterious explosion in space A few months ago, reports began to filter in of an unhappy problem with the Haskell text package: it was causing huge object files to be generated when a file contained lots of string literals. I didn’t notice the initial report (it was posted to a busy mailing list that I don’t try to keep up with), but Michael Snoyman was kind enough to take that message and file a bug. ...

12 September 2012 · 4 min · Bryan O'Sullivan

Performance: yes, it’s worth looking at the small stuff

While I was in New York for QCon last week, the temperatures started out quite mild, but soared back to their usual sweltering summertime levels by midweek. I thus found myself confined to my hotel room for a few hours one afternoon, feeling grateful for the air conditioning. As I waited for the sun to go down so that I might venture out in the heat without being cooked by both air and glare, I decided to return my attention to the Haskell text library for the first time in a while. ...

25 June 2012 · 7 min · Bryan O'Sullivan