Bryan O'Sullivan

serpentine.com · Personal blog · on HN since 2007

Bryan O'Sullivan writes about Haskell, covering parsers, benchmarking with Criterion, performance, and book reviews.

What HN saysHN commenters cite it as a great blog showing how fast Haskell can be, including a bug-hunting post and his concurrent Haskell book.
49HN people shared it
29linked it in comments
43stories submitted
725story points
5 years agolast shared
2007people per year2026

Most-shared posts

  1. 1
  2. 2
  3. 3
  4. 4
    Sometimes, the old ways are the best
    3 people · 74 points · first shared 2015 · 23 comments on HN
  5. 5
    How to write a really fast parser without going insane
    3 people · 29 points · first shared 2010 · 11 comments on HN
  6. 6
  7. 7
    Criterion: a Haskell microbenchmarking library
    3 people · 3 points · first shared 2014 · discussion on HN
  8. 8
    Ghc event manager.pdf
    3 people · first shared 2010
  9. 9
    Tutorial
    3 people · first shared 2014
  10. 10
    Wreq: a Haskell web client library
    2 people · 13 points · first shared 2014 · 1 comments on HN
  11. 11
    Big fucking deal
    2 people · 12 points · first shared 2013 · discussion on HN
  12. 12
    Fixing a space explosion in Haskell's text package
    2 people · 6 points · first shared 2012 · discussion on HN
  13. 13
  14. 14
    What’s good for C++ is good for … Haskell?
    2 people · 5 points · first shared 2013 · discussion on HN
  15. 15
    Credit where credit is due for the Hack language
    2 people · 5 points · first shared 2014 · discussion on HN

What HN people wrote when they linked it

0xmohit · 2016-06-14
For an example of a bug in aeson [1] and how it was isolated & fixed, refer to http://www.serpentine.com/blog/2015/05/13/sometimes-the-old-ways-are-t… [1] https://github.com/bos/aeson/
sbergot · 2015-07-16
> a language with no mutable types If we are talking about haskell, mutability is absolutely an option when it is the only way to write fast code. This is exactly what is done here: http://www.serpentine.com/blog/2015/05/13/sometimes-the-old-ways-are-t… > And advanced type systems are not unique to functional languages. "Advanced type system" does not really mean much. A bit like the weak/strong static typing distinction. However there are still significant differences between the c#/java/scala family and the haskell one. The fact that objects are not nullable by default and the absence of subtyping are considered as two big advantages for many people. > Also, what's up with all the single-letter variable names? when the code is abstract and the scope of a variable is less than three lines, it can be ok to use one letter for its name.
codygman · 2015-04-25
Great comments and better bug reports, just want to mention it actually says to always re-use Session in the wreq tutorial[0]. Perhaps it should be stated more prominently, repeated, or even both. For non-trivial applications, we’ll always want to use a Session to efficiently and correctly handle multiple requests. The Session API provides two important features: When we issue multiple HTTP requests to the same server, a Session will reuse TCP and TLS connections for us. (The simpler API we’ve discussed so far does not do this.) This greatly improves efficiency. 0: http://www.serpentine.com/wreq/tutorial.html#session
jgalt212 · 2014-10-15
Haskell and Clojure are both functional languages with Haskell being purer. That being said, I fairly regularly see posts about how fast Haskell is (Bryan O'Sullivan has a great blog[1]) and I rarely if ever see posts about how fast Clojure is. What is/are the reason(s) for this? Is it the fault of the JVM, or the bytecode the Clojure compiler emits? [1] http://www.serpentine.com/blog/
vamega · 2014-06-10
He also wrote a book called Parallel and Concurrent Programming in Haskell[1], which I've heard is an excellent read[2]. [1] http://chimera.labs.oreilly.com/books/1230000000929 [2] http://www.serpentine.com/blog/2014/03/18/book-review-parallel-and-con…
unhammer · 2021-11-14
> Let’s say I wanted to introduce Jordan at work, as part of a drive for a Haskell web service. I’d have to explain to everybody what the hell Rank-N types are If so, that's a problem of jordan's documentation. If it's documented with enough practical examples of how to get things done, and it's not buggy, no one needs to know about how it does it, or even why we have to write "forall" here. And I see from the article that it even uses generic so you can get instances derived for you (probably don't even have to add the RankNTypes pragma in your own files). Even the hand-written examples of https://github.com/AnthonySuper/jordan/blob/master/jordan/README.md#ex… don't seem to require any esoteric knowledge. But it's probably hard to write about Haskell without showing off all the fancy features that make things work under the hood :) I remember following http://www.serpentine.com/wreq/tutorial.html years ago for work while starting out with Haskell. It introduced the absolute minimal stuff needed for lens (I didn't delve any deeper into lens than what the tutorial showed), and I was immediately productive. Now I took a quick look at the source of wreq and the first file I see has RankNTypes, GADT's, etc. and I never knew.
ardfard · 2020-05-31
> What does Haskell have? It has Req (and a bunch of other also rans), and the docs for Req are atrocious, spanning a staggering 1 (one) example and then a meandering essay on the deficiency of other Haskell HTTP clients. It's not good enough. For HTTP request library, most would recommend Wreq. Being most popular, the documentation is really good I might say with most used API have their own example [1]. You can also easily find great tutorial on the net, like http://www.serpentine.com/wreq/tutorial.html for example. Honestly I never use Req myself and looking at the documentation myself, even though I don't it's lacking, I think it's not really geared toward Haskell beginners so maybe you have a point there. As a novice Haskell programer who only use it for side projects, I don't think the documentation is that bad and it's only getting better. Most popular libraries like database clients and web frameworks have intensive documentation and tutorial nowadays. I agree with you for the state of IDE support, it leaves something to be desired. But people are still working on it[2]. For now I mostly use vim with help of linter and formatter. The great thing about good type system is, you can still do much even without great IDE support. Haskell already have working and great REPL support that make development a breeze so it helped. I'll still take Haskell over OCaml or Scala anyday. Rust is great and I love it so much that it's my go to language for something system…
lifthrasiir · 2016-01-16
Some context: http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-… It probably marks the end of the quest to find the unconditionally correct and fast algorithm to print floating point numbers. The prior state of the art, Grisu3 (2010), is great but is only fast for 99.5% of inputs; it was nevertheless so useful that there are now several language implementations with Grisu3 (IIRC, including V8, SpiderMonkey, Go, Julia and Rust). The new algorithm, Errol3, improves Grisu3 by using double-double floating point format (instead of 64-bit custom FP) and applying more precise error analysis. Quoting the highlight of the paper: (emphases original) > After removing the narrowing and widening steps, we used the enumeration algorithm to generate a list of possibly incorrect or suboptimal inputs. Each input was run using Errol2 to enumerate a complete list of inputs that do not generate correct and optimal outputs. In total, we found that only 45 inputs (of the nearly 2^64 inputs) generate incorrect or suboptimal results; all other inputs are guaranteed to generete correct and optimal output. In order to correctly and optimally handle the failing inputs, they are hard-coded into a lookup table that maps the failing inputs to correct and optimal outputs. Combining the special handling of integers and this lookup table, Errol3 is guaranteed to be correct and optimal without runtime checks.
jfoutz · 2012-01-20
Argument from authority is not much of an argument, but dons is intensely focused on ghc performance, here's an easy to google example. http://donsbot.wordpress.com/2010/02/21/smoking-fast-haskell-code-usin… It's not to hard for you to go get benchmark numbers in haskell, check out http://www.serpentine.com/blog/2009/09/29/criterion-a-new-benchmarking… or read about how snap does its benchmarking. As for erlang, there's a lot of papers about reliability. I'm not saying the performance isn't there, it's just not a focus of the erlang community. You'll have a much tougher time figuring out instruction counts for a given function in erlang. Given that erlang is interpreted, without a major focus on performance, it seems unlikely erlang would be quicker. This is just - what i perceive as - the general consensus. I'd love for you to generate some numbers to prove me wrong.
lalaithion · 2018-01-31
Optimizing them is a bit more work, but they can outperform hand-rolled C code: http://www.serpentine.com/blog/2014/05/31/attoparsec/
chongli · 2016-08-15
Among parser combinator libraries, attoparsec[0] is no slouch. It gets very close to the speed of the hand-rolled http-parser library while being much shorter, easier to read, and maintain[1]. [0] https://hackage.haskell.org/package/attoparsec [1] http://www.serpentine.com/blog/2010/03/03/whats-in-a-parser-attoparsec…
gghh · 2015-06-26
All correct, but I don't think Bryan O'Sullivan does much haskell these days. He's the manager of some sort of "Developer productivity" team. The Hack programming language came out of his team [1] (tho he wrote a blog post to contrast all the media coverage and say "my people did it, not me! [2]); he spoke about his activity at the last F8 [3]. But he does teach Haskell at Facebook after work :) [4] [1] https://twitter.com/bos31337/status/446679462835273728 [2] http://www.serpentine.com/blog/2014/03/28/where-credit-belongs-for-hac… [3] https://www.youtube.com/watch?v=X0VH78ye4yY [4] https://twitter.com/bos31337/status/476536457000415232 EDIT: spelling
chriswarbo · 2014-12-30
>>> timeit(a, number=1000000) ... 0.102125167847 Measurements shouldn't be quoted without some kind of range, confidence interval, error bar, etc. I've not come across timeit before, but maybe they could learn a thing or two from systems like Criterion http://www.serpentine.com/criterion/
thu · 2014-10-30
In the HTTP benchmark game, there is also Bryan O'Sullivan's attoparsec-based parser: http://www.serpentine.com/blog/2014/05/31/attoparsec/ The important point is that the parser is a few dozen lines of code (i.e. it relies on a general parsing library instead of being custom hand-written code).
repsilat · 2011-08-03
I think this is still a library problem, not a language problem. "Compiling" a string at runtime for `sprintf` isn't any more difficult than doing it at compile-time, and plenty of regex libraries do very similar things. Compiling of printf strings isn't done, though, because nobody cares about string performance unless they're writing UNIX command-line utils. If you're writing C you're probably only dealing with strings for (infrequent) IO, spending the vast majority of your time crunching away on pointers and integer types (floats in niche cases). In the end, you're probably only printing something out because someone needs to read it, and how fast can humans read, anyway? This goes just as much for the printing of floating point numbers. (http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-…
tibbe · 2011-04-07
It depends on what you compare to. Bryan aimed for speed got to 56% of the speed of the C parser he used as a benchmark, using 54 lines of code. The C parser is a 1,672 lines hand-rolled parser that's only does HTTP, while attoparsec is a general purpose library. Bryan wrote about it here: http://www.serpentine.com/blog/2010/03/03/whats-in-a-parser-attoparsec…
pufuwozu · 2010-11-16
The Windows operating system presents a difficulty to our current design. Its support for scalable event notification is based around I/O completion ports, which are integrated tightly with the Windows threading mechanism, and which would require a considerable amount of replumbing to support. From http://www.serpentine.com/bos/files/ghc-event-manager.pdf
gtani · 2010-09-03
Erlang, scala/akka, haskell/ghc and clojure all have compelling takes on concurrency (C#/F# too). In erlang's case, it's the lightest of lightweight processes. I've seen blogs describing erlang apps spinning up millions of processes. Those are the kinds of numbers that akka and ghc are shooting for (I don't have an akka reference: http://www.serpentine.com/blog/2009/12/17/making-ghcs-io-manager-more-… http://www.slideshare.net/jboner/akka-scala-days-2010
dons · 2010-06-21
It has a pretty huge impact on Haskell, http://www.serpentine.com/bos/files/ghc-event-manager.pdf (See page 5 for the graphs).
s2r2 · 2009-09-05
Just stumbled upon this (Bryan O’Sullivan's blog): http://www.serpentine.com/blog/2009/09/04/slides-from-my-cufp-2009-key… And now for the direct link: http://www.serpentine.com/bos/files/cufp.pdf Edit: What a wonderful presentation! (Even though there's not one line of Haskell in it)
jrochkind1 · 2018-01-04
The OP's argument that fork doesn't make a lot of sense for what it gets used for seems persuasive, I'm definitely curious how it ended up that way. This was relatively early days for multi-tasking (ie "time-sharing") at all, maybe the only explanation is that it was early days and it wasn't clear how it was going to end up being used and 'fork' was convenient to implement. Or that's how the previous time-sharing OSs did it, for equally mysterious reasons, and it was copied? I dunno. The suggestion that it was done this way because the expected main use case was a fork without an exec at least provides a rational explanation (I don't think 'threads' as distinct from processes existed yet in unix? a fork without an exec was the closest thing you had), but I have no idea if it's historically accurate. Would be interesting to find people who were around and get some background. Ah, this is interesting: > Then came Unix, in the early 1970s. The Unix notion of a “process” became a sequential thread of control plus a virtual address space (incidentally, the Unix notion of a process derived directly from the Multics process design [Saltzer, 66]). So “processes”, in the Unix sense, are quite heavyweight machines. Since they cannot share memory (each has its own address space), they interact through pipes, signals, etc). Shared memory (also a rather ponderous mechanism) was added much later. > After some time, Unix users started to miss the old processes that could share memory.…
lispm · 2016-03-22
> They're not that bad (GNU coreutils is generally pretty good) and you usually remember the edge cases fairly quickly (eg `dd`). Sadly you get inconsistencies in all coding frameworks, whether it's semantic, function names in the core libraries or whatever. Generally this is all awful and low-level. Just see the UI interface difference between 'dd' and 'Copy File' on a Lisp Machine. The UI is worlds away. > UNIX shells do have a lot of hidden gotchya's which can make life "interesting" (read: "oh fuck oh fuck oh fuck" lol). But the power of being able to use reusable blocks of any language through pipelining (and to a lesser extent, exit codes) is genius. It means one can mix and match LISP, Java, Perl, Python, C++, Go all inside one shell script. You can do that on a Lisp Machine, too. With the difference that no pipelining of text is necessary. Just reuse the objects. The data is all fully object-oriented and self identifying. Note that I'm using Unix and other OS variants since the 80s and I'm fully aware of command line UIs from VMS, SUN OS, Cisco, IBM AIX, OSX, GNU, Plan9, Oberon OS, and various others. > I do understand the hate towards UNIX shells. It's not hate. Most Unix shells are just fully dumb. Many people like to use primitive text based UIs with lots of corner cases, which makes them look intelligent for remembering obscure commands, obscure options without real UI help. Take cp. The shell does not know the various options the command takes. The shell…
GetContented · 2016-01-27
Thanks for the comments and encouragement, it really helps a lot! What you describe is precisely what we've aimed at the whole time, but there is a reasonable amount of work that the absolute beginner has to get through before one can tackle anything at that level. The work we've done so far is about as real world as a beginner could hope for, we think. Mind you, up to section 8 pretty much has to be toyish programs of a few lines of code so as not to bamboozle the reader, because they know very little up to there. These sections are tiny for that reason - to keep them interested. We're slowly releasing the sections for free. Just released another one today (Section 8). It won't be until Section 9 that we start to encounter programs that one could see how they might be truly useful if more work was done on them. Finding all the movies in your movie collection that start with a letter in the first half of the alphabet is pretty toy, for example (in Section 9) :) - that's the next section we'll release for free on the site. However, we can start to see how that could easily become something useful - like maybe a DVD collection manager database kind of thing, with a bit more coding. Then, when at around Section 17, we know enough Haskell to be able to read small, but real programs: a times-table "game", and a tiny adventure game (it only has 2 rooms). These are trivial non-real programs from a real-world perspective, but they contain a lot of the elements needed for real…
tikhonj · 2013-03-05
Simple does not imply easy. As an extreme example, a unicycle is simpler than a bicycle--fewer components, simpler structure, no gearing--but also more difficult to learn. Really, I'll just have to point you to the "Simple Made Easy" talk again. The core point being that there's a difference between something being "simple" and something being "easy", and we should generally strive for the former rather than the latter. Having a deep theoretical foundation is also not a sign of complexity. Instead, like most of math, it's usually a sign of simplicity. After all, math always strives for elegance and simplicity. What it means is that a lot of smart people have spent a lot of time thinking things through using a strict framework for reasoning that ensures everything is consistent. The theoretical framework lets us simplify by recasting different concepts using the same fundamental ideas. If we can capture things like state, errors and non-determinism using a single concept, we've made things simpler because now we have a common ground and relationship between seemingly disjoint ideas. This is exactly what Haskell (and the theory behind it) does. This theoretical foundation, coupled with the relative simplicity and consistency of the language, actually make code much easier to reason about in Haskell than in other languages, except for some performance issues. Basically, as long as your main concern is in semantics--and, for 90% of your code, it is--Haskell makes life easier…
allenleein · 2017-09-02
If you want to learn Haskell or functional language: Haskell for all- http://www.haskellforall.com/ Bryan O'Sullivan's blog- http://www.serpentine.com/blog/ Monday Morning Haskell- https://mmhaskell.com/ Jane Street- https://blog.janestreet.com/ Haskell Weekly- https://haskellweekly.news/ Neil Mitchell's Haskell Blog-http://neilmitchell.blogspot.tw/ Types & Functional Programming- http://bitemyapp.com/ Haoyi's Programming Blog- http://www.lihaoyi.com/post/WhatsFunctionalProgrammingAllAbout.html
ionfish · 2010-07-13
So much good stuff in there. Brian O'Sullivan mentioned his paper on the GHC event manager on his blog: http://www.serpentine.com/blog/2010/06/14/sightings-of-the-ghc-event-m… He also linked a preprint: http://www.serpentine.com/bos/files/ghc-event-manager.pdf There are also plenty of discussions on the mailing list. http://groups.google.com/group/ghc-io-manager Brent Yorgey is of course the current editor of The Monad.Reader, and the author of the Typeclassopedia, so I'm looking forward to his paper too. http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf http://themonadreader.wordpress.com/ http://byorgey.wordpress.com/

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close