Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Donald Bruce Stewart <dons <at> cse.unsw.edu.au>
Subject: Re: ByteStrings and the ram barrier
Newsgroups: gmane.comp.lang.haskell.libraries
Date: Sunday 14th May 2006 01:24:18 UTC (over 11 years ago)
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
 
CD: 2ms