Re: [Haskell-cafe] slow code

2009-06-17 Thread Ketil Malde
brian bri...@aracnet.com writes: However, I would like to reiterate that it's the double - string which is really the time/memory sink. I verified this by printing a simple string based on the value (to make sure the value was evaluated) and it runs fast enough for me. Is there an

Re: [Haskell-cafe] slow code

2009-06-17 Thread Matthias Görgens
Still, a fast and general way to output primitive data types would be quite welcome. Naive question: Can't we just ask C to do it for us? (With a foreign function call.) Matthias. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] slow code

2009-06-17 Thread Don Stewart
matthias.goergens: Still, a fast and general way to output primitive data types would be quite welcome. Data.Binary is the way (though it doesn't yet use direct output for float and double bits) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] slow code

2009-06-16 Thread Don Stewart
briand: I have included a new and improved version. Just to make the comparison a little more reasonable I re-wrote the program using ML and ran it with SMLNJ eal 0m3.175s user 0m0.935s sys 0m0.319s Here's the compiled haskell (ghc -O2 foo.hs -o foo): real 0m16.855s user

Re: [Haskell-cafe] slow code

2009-06-16 Thread brian
On Jun 16, 2009, at 8:58 AM, Don Stewart wrote: So I guess it's the show's, but I can't seem to find more efficient float output. FFI to sprintf ? yuch. Is your SMLNJ using lazy lists? :) strictly speaking : no. Try hmatrix or uvector. uvector is _probably_ the long term answer even

Re: [Haskell-cafe] slow code

2009-06-16 Thread Jason Dagit
On Tue, Jun 16, 2009 at 6:47 PM, brian bri...@aracnet.com wrote: On Jun 16, 2009, at 8:58 AM, Don Stewart wrote: So I guess it's the show's, but I can't seem to find more efficient float output. FFI to sprintf ? yuch. Is your SMLNJ using lazy lists? :) strictly speaking : no. Try

Re: [Haskell-cafe] slow code

2009-06-15 Thread Thomas ten Cate
How much output does this generate? Does it matter if you send the output to /dev/null? This looks as if the bottleneck might well be in I/O operations, not in the code itself. To find this out, you could rewrite the code in C and see if that makes a difference? Thomas On Sun, Jun 14, 2009 at

Re: [Haskell-cafe] slow code

2009-06-15 Thread brian
I have included a new and improved version. Just to make the comparison a little more reasonable I re-wrote the program using ML and ran it with SMLNJ eal 0m3.175s user0m0.935s sys 0m0.319s Here's the compiled haskell (ghc -O2 foo.hs -o foo): real0m16.855s user0m9.724s

[Haskell-cafe] slow code

2009-06-14 Thread brian
Haskell Gurus, I have tried to use profiling to tell me what's going on here, but it hasn't helped much, probably because I'm not interpreting the results correctly. Empirically I have determined that the show's are pretty slow, so an alternative to them would be helpful. I replaced the