Re[2]: [Haskell-cafe] memory issues

2009-02-28 Thread Bulat Ziganshin
Hello Daniel, Saturday, February 28, 2009, 6:20:09 PM, you wrote: > But they would not be equivalent if stdout has to be locked for each output > operation separately, but a file opened with openFile fp WriteMode was > locked then once and remained so until closed. ghc Handles are locked for eve

Re: [Haskell-cafe] memory issues

2009-02-28 Thread Daniel Fischer
Hello Bulat, Am Samstag, 28. Februar 2009 09:38 schrieb Bulat Ziganshin: > Hello Daniel, > > Saturday, February 28, 2009, 3:10:44 AM, you wrote: > >> print may waste a lot of time, locking stdout for every > >> line printed > > > > hout <- openFile (args!!1) WriteMode > > mapM_ (hPrint hout

Re[2]: [Haskell-cafe] memory issues

2009-02-28 Thread Bulat Ziganshin
Hello Daniel, Saturday, February 28, 2009, 3:10:44 AM, you wrote: >> print may waste a lot of time, locking stdout for every >> line printed > hout <- openFile (args!!1) WriteMode > mapM_ (hPrint hout) $ sort $ blocks content > ? I find hardly any difference, though. no difference. if

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Daniel Fischer
Am Samstag, 28. Februar 2009 00:37 schrieb Bulat Ziganshin: > Hello Daniel, > > Saturday, February 28, 2009, 2:21:31 AM, you wrote: > >> printf "%s" $ unlines $ map (show) (sort $! blocks content) > > > > Bad! > > Use > > mapM_ print $ sort $ blocks content > > are you sure? Tested it. T

Re[2]: [Haskell-cafe] memory issues

2009-02-27 Thread Bulat Ziganshin
Hello Don, Saturday, February 28, 2009, 2:18:37 AM, you wrote: > offset :: !Integer oh yes > And possibly just using {-# UNPACK #-}!Int64 would be ok? i think that it will be even better but main problem is a huge unevaluated thunks. as the last hope, this may be converted to x <- getOffs

Re[2]: [Haskell-cafe] memory issues

2009-02-27 Thread Bulat Ziganshin
Hello Daniel, Saturday, February 28, 2009, 2:21:31 AM, you wrote: >> printf "%s" $ unlines $ map (show) (sort $! blocks content) > Bad! > Use > mapM_ print $ sort $ blocks content are you sure? print may waste a lot of time, locking stdout for every line printed $! is really useless

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Daniel Fischer
Am Freitag, 27. Februar 2009 23:18 schrieb Rogan Creswick: > > \begin{code} > -- Compiled with: > -- $ ghc --make offsetSorter.hs > -- > -- (ghc v. 6.8.2) > -- > -- Run with: > -- $ time ./offsetSorter data/byteOffsets.txt > haskOffsets.txt > -- offsetSorter: out of memory (requested 1048576 bytes

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Don Stewart
bulat.ziganshin: > Hello Rogan, > > Saturday, February 28, 2009, 1:18:47 AM, you wrote: > > > data Block = Block { > > offset::Integer > > , size::Integer > > } deriving (Eq) > > try >!offset::Integer > , !size::Integer > offset :: !Integer And possibly just usi

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Bulat Ziganshin
Hello Rogan, Saturday, February 28, 2009, 1:18:47 AM, you wrote: > data Block = Block { > offset::Integer > , size::Integer > } deriving (Eq) try !offset::Integer , !size::Integer -- Best regards, Bulatmailto:bulat.zigans...@gmail.com __

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Don Stewart
creswick: > On Fri, Feb 27, 2009 at 2:20 PM, Don Stewart wrote: > > creswick: > >> \begin{code} > >> -- Compiled with: > >> -- $ ghc --make offsetSorter.hs > > > > YIKES!! Use the optimizer! > > > >    ghc -O2 --make > > Ah, that did drastically cut the amount of time it takes to run out of > mem

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Rogan Creswick
On Fri, Feb 27, 2009 at 2:20 PM, Don Stewart wrote: > creswick: >> \begin{code} >> -- Compiled with: >> -- $ ghc --make offsetSorter.hs > > YIKES!! Use the optimizer! > >    ghc -O2 --make Ah, that did drastically cut the amount of time it takes to run out of memory (down to 1:23), but unfortunat

Re: [Haskell-cafe] memory issues

2009-02-27 Thread Don Stewart
creswick: > First off, my apologies for breaking etiquette, if/when I do -- I've > only just joined Haskell-cafe, and I'm quite new to Haskell. > > I have recently been trying to process a large data set (the 2.8tb > wikipedia data dump), and also replace my scripting needs with haskell > (needs t

[Haskell-cafe] memory issues

2009-02-27 Thread Rogan Creswick
First off, my apologies for breaking etiquette, if/when I do -- I've only just joined Haskell-cafe, and I'm quite new to Haskell. I have recently been trying to process a large data set (the 2.8tb wikipedia data dump), and also replace my scripting needs with haskell (needs that have previously be