Re: [Haskell-cafe] Streaming bytes and performance

2013-03-20 Thread Konstantin Litvinenko
On 03/20/2013 12:47 AM, Branimir Maksimovic wrote: Your problem is that main_6 thunks 'i' and 'a' . If you write (S6 !i !a) - get than there is no problem any more... Nope :( Unfortunately that doesn't change anything. Still allocating... ___

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-20 Thread Konstantin Litvinenko
On 03/20/2013 11:17 AM, Branimir Maksimovic wrote: Are you sure? I use ghc 7.6.2 Huh, I use 7.4.2, and if 7.6.2 can handle this I will try to switch. Not sure how to do that on ubuntu 12.10... ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-20 Thread Konstantin Litvinenko
On 03/20/2013 11:17 AM, Branimir Maksimovic wrote: Are you sure? I use ghc 7.6.2 (compiled with -O2) and without bang patterns for 1million iterations it blows stack space. With bang patterns it runs in constant space , same as other version? Okay, I have found the root of allocation problem.

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-19 Thread Konstantin Litvinenko
On 03/19/2013 07:12 AM, Edward Kmett wrote: Konstantin, Please allow me to elaborate on Dan's point -- or at least the point that I believe that Dan is making. Using, let bug = Control.DeepSeq.rnf str `seq` fileContents2Bug str or ($!!)will create a value that *when forced* cause the

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-19 Thread Konstantin Litvinenko
On 03/18/2013 02:14 PM, Gregory Collins wrote: Put a bang pattern on your accumulator in go. Since the value is not demanded until the end of the program, you're actually just building up a huge space leak there. Fixed that Secondly, unconsing from the lazy bytestring will cause a lot of

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-19 Thread Konstantin Litvinenko
On 03/19/2013 10:32 PM, Don Stewart wrote: Oh, I forgot the technique of inlining the lazy bytestring chunks, and processing each chunk seperately. $ time ./fast 4166680 ./fast 1.25s user 0.07s system 99% cpu 1.325 total Essentially inline Lazy.foldlChunks and specializes is (the inliner

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-19 Thread Konstantin Litvinenko
On 03/19/2013 10:53 PM, Nicolas Trangez wrote: On Tue, 2013-03-19 at 20:32 +, Don Stewart wrote: So about 8x faster. Waiting for some non-lazy bytestring benchmarks... :) You could try something like this using Conduit: {-# LANGUAGE BangPatterns #-} module Main (main) where import

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-19 Thread Konstantin Litvinenko
On 03/19/2013 10:49 PM, Konstantin Litvinenko wrote: {-# LANGUAGE BangPatterns #-} import Control.Monad.State.Strict data S6 = S6 !Int !Int main_6 = do let r = evalState go (S6 1 0) print r where go = do (S6 i a) - get if (i == 0) then return a else

[Haskell-cafe] Streaming bytes and performance

2013-03-18 Thread Konstantin Litvinenko
Hi All! I tune my toy project for performance and hit the wall on simple, in imperative world, task. Here is the code that model what I'm trying to achieve import qualified Data.ByteString.Lazy as L import Data.Word8(isSpace) import Data.Word import Control.Monad.State type Stream = State

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Konstantin Litvinenko
On 03/17/2013 07:08 AM, C K Kashyap wrote: I am working on an automation that periodically fetches bug data from our bug tracking system and creates static HTML reports. Things worked fine when the bugs were in the order of 200 or so. Now I am trying to run it against 3000 bugs and suddenly I

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Konstantin Litvinenko
On 03/18/2013 06:06 PM, Dan Doel wrote: Do note that deepSeq alone won't (I think) change anything in your current code. bug will deepSeq the file contents. rfn fully evaluate 'bug' by reading all file content. Later hClose will close it and we done. Not reading all content will lead to semi

Re: [Haskell-cafe] regex-pcre is not working with UTF-8

2012-08-21 Thread Konstantin Litvinenko
On 08/18/2012 06:16 PM, José Romildo Malaquias wrote: Hello. It seems that the regex-pcre has a bug dealing with utf-8: I hope this bug can be fixed soon. Is there a bug tracker to report the bug? If so, what is it? You need something like that let pat = makeRegexOpts (compUTF8 .|.

[Haskell-cafe] Organizing big repository

2011-10-27 Thread Konstantin Litvinenko
I am trying to understand how to organize my code and edit-compile-run cycles. I can't figure out how to setup environment in such why that when I build some program using cabal, cabal will rebuild program dependencies if some was changed. I don't want to configure/build/install manually. Having