New patches in /srv/darcs/git-mirrors/utf8-string
Ian Lynagh
igloo at earth.li
Fri Dec 2 12:24:33 CET 2011
New patches in /srv/darcs/git-mirrors/utf8-string
commit d7386bea7fe286483ea559fb9b3898be080af700
Merge: ec2b859... b7aa0a0...
Author: Eric Mertens <emertens at gmail.com>
Date: Thu Nov 17 13:35:01 2011 -0800
Merge pull request #4 from TomMD/master
Minor performance improvements
commit b7aa0a0b51e79186980e55403cd9018795fe3692
Author: Thomas M. DuBuisson <Thomas.DuBuisson at gmail.com>
Date: Thu Nov 17 13:06:44 2011 -0800
Add BangPatterns for an accumulator. Inline decode. Specialize take, drop.
When considering a simple benchmark [1]:
let p = ((== "en") . U.take 2)
print . length . filter p . U.lines =<< L.readFile . head =<< getArgs
It's apparent that we are underperforming (compare to the shell script
solution, this take twice as long). The accumulator of splitAt wasn't
strict (used bang patterns). Also, even with -O2, the construction /
destruction of the tuple for take & drop's lifting of splitAt wasn't
being optimized away. Perhaps more investigation should be done re:
GHC, but the cheap solution is to just duplicate code for take and
drop, which is what this patch does.
Original: user 0m1.704s
Final: user 0m1.092s
[1] http://stackoverflow.com/questions/8172889/quickly-parse-large-utf-8-text-file-in-haskell
More information about the Cvs-ghc
mailing list