ByteStrings and the ram barrier
Donald Bruce Stewart
dons at cse.unsw.edu.au
Sat May 13 21:24:18 EDT 2006
kahl:
> >
> > After tuning the chunk size to the cache size, the filter 'e' test now
> > runs in:
> > 4.52 minutes, 53% cpu.
>
> With respect to the original comparison,
> Ryan Lortie pointed out that ``sed'' is an unfair comparison,
> and ``tr'' would be more appropriate.
Hi!
Good idea, I always forget about tr. Here's the result:
manzano$ time tr -d e < /home/dons/data/10G > /dev/null
tr -d e < /home/dons/data/10G > /dev/null 26% cpu 4:34.55 total
I'm happy with this, within 6% of C, for a one liner. The Haskell program is:
> import System.IO
> import Data.Char
> import qualified Data.ByteString.Lazy as L
>
> main = L.hGetContents stdin >>= L.hPut stdout . L.filterNotByte e
> where e = fromIntegral . ord $ 'e'
-- Don
More information about the Libraries
mailing list