File: big.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 (12 lines) | stat: -rw-r--r-- 324 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
import qualified Data.ByteString as S
import System.IO.Posix.MMap
import Control.Monad
import Text.Printf

main = do
      s <- unsafeMMapFile "/usr/obj/data/1G"
      print "This program should touch only 1 page per 100k"

      forM_ [0, (1024) .. S.length s-1] $ \n -> do
          printf "n=%d := %d\n" n (S.index s n)