[GHC] #4965: 60% performance regression in continuation-heavy code between 6.12 and 7
GHC
cvs-ghc at haskell.org
Wed Feb 16 22:37:39 CET 2011
#4965: 60% performance regression in continuation-heavy code between 6.12 and 7
---------------------------------+------------------------------------------
Reporter: bos | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Runtime performance bug
---------------------------------+------------------------------------------
I have a JSON parsing library whose performance has regressed by a little
over 60% between 6.12.3 and the current head of the 7.0 branch.
The library uses my attoparsec parsing library, which is written in a
heavily continuation-based style.
== Building the code ==
Reproducing the problem is pretty easy.
You need two git repos:
{{{
git clone git://github.com/bos/attoparsec
git clone git://github.com/mailrank/aeson
}}}
They're easily built:
{{{
(cd attoparsec && cabal install)
(cd aeson && cabal install)
}}}
== Measuring performance ==
Inside the aeson repo are some benchmarks, of which {{{AesonParse}}} is
the only interesting one for our purposes.
{{{
cd aeson/benchmarks && make AesonParse
}}}
There's also prepackaged test data, so you can run a benchmark on the
spot.
{{{
./AesonParse 1000 json-data/twitter100.json
}}}
This program accepts a number of loop iterations as its first argument,
and a data file as its second. It prints its execution time, so a smaller
number indicates better performance.
== Performance with 6.12.3 ==
Here's what I see with 6.12.3, on my MacBook Pro running OS X 10.6.5.
{{{
$ ./AesonParse 1000 json-data/twitter100.json
json-data/twitter100.json:
1000 good, 1.847631s
}}}
This number is good - it's about as fast as Python's C-based json parser.
== Performance with GHC 7 ==
You can pass a {{{ghc}}} argument to {{{make}}} to build the benchmark
with a different compiler.
{{{
make clean
make AesonParse ghc=/usr/local/ghc/7/bin/ghc
}}}
And with the benchmark rebuilt, here's the performance:
{{{
$ ./AesonParse7 1000 json-data/twitter100.json
json-data/twitter100.json:
1000 good, 2.939818s
}}}
This is one of the very few instances I've seen of a performance
regression with GHC 7, and unfortunately it's very large.
Please let me know what other information I can provide.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4965>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list