File: big-lazy.hs

package info (click to toggle)
haskell-bytestring-mmap 0.2.2-13
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 116 kB
  • sloc: haskell: 230; ansic: 11; sh: 7; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 560 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import qualified Data.ByteString.Lazy as L
import System.IO.Posix.MMap.Lazy
import Control.Monad
import Text.Printf
import System.Mem

main = do
      s <- unsafeMMapFile "/usr/obj/data/1G"
      go 0 s
   where
      go n s
        | L.null s = return ()
        | otherwise
          = do -- printf "%d\n" 
               L.head s `seq` return ()
               when (n `mod` 1000 == 0) $ do
                    performGC -- tune this value for when to run the GC
               go (n+1) (L.drop 4096 s)


--    forM_ [0, (1024) .. L.length s-1] $ \n -> do