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-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[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] Re: How to work with date?

2009-03-02 Thread Bulat Ziganshin
Hello Jon, Monday, March 2, 2009, 2:22:55 PM, you wrote: > take 10 $ map (addDays (-1)) $ repeat $ utctDay $ zonedTimeToUTC now take 10 $ iterate (addDays (-1)) $ utctDay $ zonedTimeToUTC now -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___

Re[2]: [Haskell-cafe] Assignment of grayCode

2009-03-02 Thread Bulat Ziganshin
Hello Neil, Monday, March 2, 2009, 2:53:04 PM, you wrote: > That seems a reasonable description, but without checking with the > person who set the test, you may never know for sure. I personally > can't see any difference between your second version and the original > question... he probably th

Re: [Haskell-cafe] help optimizing memory usage for a program

2009-03-02 Thread Bulat Ziganshin
Hello Manlio, Monday, March 2, 2009, 6:30:51 PM, you wrote: > The process-data-1 program parse the entire dataset using about 1.4 GB > of memory (3x increment). > This is strange. > The memory required is proportional to the number of ratings. > It may be IntMap the culprit, or the garbage colle

Re[2]: [Haskell-cafe] help optimizing memory usage for a program

2009-03-02 Thread Bulat Ziganshin
Hello Manlio, Monday, March 2, 2009, 8:16:10 PM, you wrote: > 1) With default collection algorithm, I have: > 2) With -c option: > So, nothing changed. you should look into +RTS -s stats. those 409 vs 418 mb is just somewhat random values, since GCs in those 2 inviocations are not synchronized

Re[2]: [Haskell-cafe] help optimizing memory usage for a program

2009-03-02 Thread Bulat Ziganshin
Hello Manlio, Monday, March 2, 2009, 8:16:10 PM, you wrote: > By the way: I have written the first version of the program to parse > Netflix training data set in D. > I also used ncpu * 1.5 threads, to parse files concurrently. > However execution was *really* slow, due to garbage collection. >

Re[2]: [Haskell-cafe] help optimizing memory usage for a program

2009-03-02 Thread Bulat Ziganshin
Hello Kenneth, Monday, March 2, 2009, 11:14:27 PM, you wrote: > I think my approach is turning out better because I'm: > - building up the IntMap using 'empty' and 'insert', instead of > combining 17,770 'singleton' IntMaps >(which probably results better GC behavior) i don't read into de

Re[2]: [Haskell-cafe] help optimizing memory usage for a program

2009-03-02 Thread Bulat Ziganshin
Hello Austin, Monday, March 2, 2009, 11:51:52 PM, you wrote: >> let's calculate. if at GC moment your program has allocated 100 mb of >> memory and only 50 mb was not a garbage, then memory usage will be 150 >> mb > ? A copying collector allocates a piece of memory (say 10mb) which is > used as

Re[2]: [Haskell-cafe] interaction between ghci and cudaBLAS library

2009-03-03 Thread Bulat Ziganshin
Hello Don, Tuesday, March 3, 2009, 5:22:46 AM, you wrote: > GHCi doesn't use the threaded runtime though. So given that: Don, afair ghci compiled using threaded runtime since 6.6: Prelude> :m Control.Concurrent Prelude Control.Concurrent> rtsSupportsBoundThreads True -- Best regards, Bulat

Re[2]: [Haskell-cafe] possible memory leak in uvector 0.1.0.3

2009-03-03 Thread Bulat Ziganshin
Hello Manlio, Tuesday, March 3, 2009, 1:10:48 PM, you wrote: > It *is* a problem with IntMap. > I have changed the program to not use any array concatenation, and it > still requires a lot of memory. it may be problem with something else. in particular, check that you don't have lazy thunks sto

Re[2]: [Haskell-cafe] possible memory leak in uvector 0.1.0.3

2009-03-03 Thread Bulat Ziganshin
Hello Manlio, Tuesday, March 3, 2009, 5:35:33 PM, you wrote: > There are 100,000,000 ratings, so I create 100,000,000 arrays containing > only one element. every array needs ~30 bytes - it's a minimal memory block ghc can alloc for variable-sized objects. multiple this by 3 to account for copyin

Re[2]: [Haskell-cafe] possible memory leak in uvector 0.1.0.3

2009-03-03 Thread Bulat Ziganshin
Hello Daniel, Tuesday, March 3, 2009, 5:47:36 PM, you wrote: >>let v = map singleton' $ ratings contents >>let m = foldl1' (unionWith appendU) v >>v `seq` return $! m > The (v `seq` ) is completely useless. > Maybe > (size m) `seq` return m > would help? i suggest retur

Re: [Haskell-cafe] Threading and Mullticore Computation

2009-03-03 Thread Bulat Ziganshin
Hello mwinter, Tuesday, March 3, 2009, 8:09:21 PM, you wrote: >anybody give me an idea what I am doing wrong? 1. add -O2 to compile command 2. add +RTS -s to run commands your program execution time may be dominated by GCs -- Best regards, Bulatmailto:bulat.z

Re[2]: [Haskell-cafe] Threading and Mullticore Computation

2009-03-03 Thread Bulat Ziganshin
are done (sequentially resp. > parallel), so the gc should be the same. But still using 2 cores is > much slower than using 1 core (same program - no communication). > On 3 Mar 2009 at 20:21, Bulat Ziganshin wrote: >> Hello mwinter, >> >> Tuesday, March 3, 2009, 8:09:21

Re[2]: [Haskell-cafe] Threading and Mullticore Computation

2009-03-03 Thread Bulat Ziganshin
Hello Andrew, Tuesday, March 3, 2009, 9:21:42 PM, you wrote: > I just tried it with GHC 6.10.1. Two capabilities is still slower. (See > attachments. Compiled with -O2 -threaded.) i don't think so: Total time4.88s ( 5.14s elapsed) Total time7.08s ( 4.69s elapsed) so with 1 thr

Re[2]: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Bulat Ziganshin
Hello Colin, Saturday, March 7, 2009, 8:30:43 PM, you wrote: > >> Data/Tree/Game/Tree.hs:1:0:    Failed to load interface for > >> `Prelude':      it is a member of package base-3.0.3.0, which > >> is hidden > build-depends: base >= 4 and which ghc version you are running? :)

Re: [Haskell-cafe] serializing large data structures, stack overflow

2009-03-07 Thread Bulat Ziganshin
Hello friggin, Saturday, March 7, 2009, 10:57:04 PM, you wrote: > dec = B.decodeFile "C:/users/saftarn/desktop/bintest.txt" >>= \a -> >   return $ (a :: M.Map (Int,Int) Int) just a quick style hack: dec = B.decodeFile "C:/users/saftarn/desktop/bintest.txt" :: IO (M.Map (Int,Int) Int) --

Re: [Haskell-cafe] ANNOUNCE: Holumbus-MapReduce 0.0.1

2009-03-08 Thread Bulat Ziganshin
Hello Stefan, Sunday, March 8, 2009, 4:47:25 PM, you wrote: > Wedel, Germany, I have developed a library for building distributed > MapReduce systems in Haskell. > Holumbus-Distribution consists of modules and tools for the > implementation of distributed systems in general. > Holumbus-Storage

Re[2]: [Haskell-cafe] Logo Preferences

2009-03-09 Thread Bulat Ziganshin
Hello Sebastian, Monday, March 9, 2009, 1:08:50 PM, you wrote: i think we should make 2-stage voting, like in F1 after 1st stage we will know which logos are most popular and therefore are real candidates, so we can select among them > On Sun, Mar 8, 2009 at 11:19 PM, Ashley Yakeley wrote: >

Re[4]: [Haskell-cafe] Logo Preferences

2009-03-09 Thread Bulat Ziganshin
Hello Sebastian, Tuesday, March 10, 2009, 1:08:38 AM, you wrote: > It just seems like duplicated work to me. They're still few enough > that I can scan through them and multi-select the ones I like and > then click "move to top" in a pretty short amount of time (and then refine > the ranking if

Re: [Haskell-cafe] Microsoft PhD Scholarship at Strathclyde

2009-03-10 Thread Bulat Ziganshin
Hello Conor, Tuesday, March 10, 2009, 6:59:58 PM, you wrote: > {- > -- Haskell Types with Numeric Constraints > -} are you have in mind integrating results into produc

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Tuesday, March 10, 2009, 10:40:30 PM, you wrote: >> I think uvector only works with certain types that can be >> unboxed, while storablevector works with all types that >> instantiate Foreign.Storable.Storable. I don't know about >> vector. From the description of vector, I have the

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Tuesday, March 10, 2009, 11:01:31 PM, you wrote: >> if uavector use ghc's built-in unboxed array operations (as >> Data.Array.Unboxed does) then it's necessarily bounded to types >> supported by those operations > And what is Storable limited to? > Ultimately they're all limited to t

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Xiao-Yong, Tuesday, March 10, 2009, 11:52:50 PM, you wrote: > So it's me who understand it wrong. If I want some high > performance array with elements of custom data type, I'm > stuck with Array, anyway? ForeignArray will be the best here. just make you type instance of Storable. if you

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: > Right, so my point stands: there's no difference now. If you can write a > Storable instance, you can write a UA et al instance. yes, if there is some class provided for this and not just hard-coded 4 or so base types > And GHC 6.

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Xiao-Yong, Wednesday, March 11, 2009, 12:28:45 AM, you wrote: > It goes beyond my current knowledge, now. How do you define > a custom data type as an instance of UA or Storable? just look at existing instances. basically, for complex data type, you just use instances for its basic types,

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Wednesday, March 11, 2009, 12:48:35 AM, you wrote: >> unfortunately, Array library unboxed arrays still aren't based on any >> Unboxable *class* > Hmm. Aren't all the array library types based on MArray and IArray? > So I can define my own say, new STUArray element type by writing an

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Bulat Ziganshin
Hello Manlio, Wednesday, March 11, 2009, 1:28:13 AM, you wrote: > Using normal String type I can define a pattern like: > But if I want to use ByteString, what should I do? > This seems impossible, since ByteString data constructor is not available. for numeric types, it works via Num instances

Re: [Haskell-cafe] Generics Versus Parametric Polymorphism

2009-03-11 Thread Bulat Ziganshin
Hello Mark, Wednesday, March 11, 2009, 9:11:42 AM, you wrote: > Just wondering if Generics and Parametric polymorphism are one and the same > in Haskell. haskell Parametric polymorphism is the same type of thing as Java Generics :) haskell Generics provides ability to define procedures polymor

Re[2]: [Haskell-cafe] Generics Versus Parametric Polymorphism

2009-03-11 Thread Bulat Ziganshin
Hello porges, Wednesday, March 11, 2009, 12:35:18 PM, you wrote: > Most importantly (or awesomely?), every time Haskell infers the > type of a function you've written, you get *the most generic possible* > version, for free :) and using generics, you can get function polymorphic on *any* type j

Re: [Haskell-cafe] Against cuteness

2009-03-11 Thread Bulat Ziganshin
Hello Gregg, Wednesday, March 11, 2009, 1:17:41 PM, you wrote: > are not O'Reilly.  Of all the billions of images from all the > cultures in the world available to us we can surely find something > that is witty or charming without being cute. it will not be fun :) -- Best regards, Bulat

Re[2]: [Haskell-cafe] Sugestion for a Haskell mascot

2009-03-11 Thread Bulat Ziganshin
Hello Wolfgang, Wednesday, March 11, 2009, 1:06:37 PM, you wrote: >> Hehe, I love it. Sloth is a synonym for Lazyness in English too, and >> they're so freaking cute... :) > Same in German: The german “Faultier” means “lazy animal”. russian too, if that matter. i was really amazed by this idea

Re: [Haskell-cafe] How to get program command line arguments in Unicode-aware way (Unix/Linux)?

2009-03-12 Thread Bulat Ziganshin
Hello Dimitry, Thursday, March 12, 2009, 5:42:14 AM, you wrote: depends on your OS. for windows i use this code: myGetArgs = do alloca $ \p_argc -> do p_argv_w <- commandLineToArgvW getCommandLineW p_argc argc <- peek p_argc argv_w <- peekArray (i argc) p_argv_w mapM peekTSt

Re: [Haskell-cafe] Re: Sugestion for a Haskell mascot

2009-03-12 Thread Bulat Ziganshin
Hello Jon, Thursday, March 12, 2009, 12:49:35 PM, you wrote: > I think using it as a mascot is a bad idea: "Haskell is so > slow, they even chose a sloth as the mascot". and it will be absolute truth :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com _

Re[2]: [Haskell-cafe] Re: Sugestion for a Haskell mascot

2009-03-12 Thread Bulat Ziganshin
Hello Satnam, Thursday, March 12, 2009, 1:08:58 PM, you wrote: > Perhaps this is just an indication of my dark and violent side, but > choosing an animal with a killer instinct might be a better idea. A > creature that would eat something small and furry as a mid afternoon snack why not choose H

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Bulat Ziganshin
Hello Don, Friday, March 13, 2009, 8:08:57 PM, you wrote: >> What is the reason why you have decided to use unpinned arrays >> (ByteArray#) instead of pinned arrays (Foreign.Ptr)? > They prevent heap fragmentation (and in general are faster). you probably mean faster alloc/gc operations, everyt

Re: [Haskell-cafe] How to catch error in array index when debugging

2009-03-14 Thread Bulat Ziganshin
Hello Colin, Saturday, March 14, 2009, 11:39:41 AM, you wrote: > I'm getting a runtime failure "Error in array index". This causes ghci > to exit. > Is there a way to get it to break instead, so I can find out which > function is failing? i recall two techniques - one is trivially define your o

Re: [Haskell-cafe] Are there performant mutable Arrays in Haskell?

2009-03-19 Thread Bulat Ziganshin
Hello Matthias, Thursday, March 19, 2009, 2:16:30 PM, you wrote: 1. use ghc -O2 2. use unsafeRead/WriteArrray 3. check that all calculations (step*, li/ri) are strict > Hey There, > I am trying to write a hash-algorithm that in fact is working, but > as you might have guessed the problem is th

[Haskell-cafe] Re[2]: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler

2009-03-19 Thread Bulat Ziganshin
Hello sylvain, Thursday, March 19, 2009, 2:16:06 AM, you wrote: > Something is wrong: how can Haskell be faster than C? 1. you measure efficiency of libs, not compilers 2. don't forget about -O2/-O3 -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Editing Haskell wiki pages

2009-03-20 Thread Bulat Ziganshin
Hello Colin, Friday, March 20, 2009, 9:18:59 AM, you wrote: > How am I supposed to edit a page on the Haskell wiki? > If I click on an "Edit this page" link, then Firefox prompts me to > choose a tool to open an application/x-external-editor. When i just it should be a problem with your config,

Re[2]: [Haskell-cafe] Ease of Haskell development on OS X?

2009-03-20 Thread Bulat Ziganshin
Hello Jeff, Friday, March 20, 2009, 10:22:35 PM, you wrote: > As this continues to build, I guess the issue for me, and I'm willing > to help with it, is trying to figure out how to redistribute programs > written with gtk2hs. on Windows, people can just install the gtk2hs > libraries via the in

Re[2]: [Haskell-cafe] Ease of Haskell development on OS X?

2009-03-20 Thread Bulat Ziganshin
Hello Don, Saturday, March 21, 2009, 12:06:48 AM, you wrote: >> i distribute my gtk2hs program for windows and linux. no problems, i >> just included runtime libraries provided by gtk2hs team. it was with >> gtk2hs 0.9.12.1 though, may be they don't provided updated archive for >> newer gtk2hs ve

Re: [Haskell-cafe] ACM Task for C++ and Java programmers in Haskell. How to make code faster?

2009-03-22 Thread Bulat Ziganshin
Hello Vasyl, Sunday, March 22, 2009, 8:25:02 PM, you wrote: i believe that i already seen this problem here a few years ago :) what search structure you was used? i think that immutable hash (represented as array of lists) would be useful here > Hi! > Recently I've found interesting ACM resear

Re: [Haskell-cafe] Equations for `foo' have different numbers of arguments

2009-03-24 Thread Bulat Ziganshin
Hello Manlio, Tuesday, March 24, 2009, 5:44:14 PM, you wrote: > divide _ 0 = error "division by 0" > divide = (/) > Equations for `divide' have different numbers of arguments you should write divide a b = a/b -- Best regards, Bulatmailto:bulat.zigans...@gmail.co

Re[2]: [Haskell-cafe] The votes are in!

2009-03-24 Thread Bulat Ziganshin
Hello Andrew, Tuesday, March 24, 2009, 6:29:18 PM, you wrote: then it was thoughtcrime and that sort of things even more dangerous for State! > He ONCE used unsafeInterleaveIO, but he never evaluated it, and never tried > it again! > 2009/3/24 Brandon S. Allbery KF8NH > > On 2009 Mar 24, a

Re: [Haskell-cafe] g++ std:map vs GHC IntMap

2009-03-26 Thread Bulat Ziganshin
Hello Manlio, Thursday, March 26, 2009, 6:39:12 PM, you wrote: > The test consists in adding 1000 elements to an empty map. +RTS -c -F1.1 then read about garbage collection -- Best regards, Bulatmailto:bulat.zigans...@gmail.com __

Re[2]: [Haskell-cafe] g++ std:map vs GHC IntMap

2009-03-26 Thread Bulat Ziganshin
Hello Manlio, Thursday, March 26, 2009, 8:17:03 PM, you wrote: > So, now memory required is about the same as the C++ version, but how > can I optimize memory usage without having to tweak the garbage collector? C++ doesn't use GC so why you compare? -- Best regards, Bulat

Re[2]: [Haskell-cafe] g++ std:map vs GHC IntMap

2009-03-26 Thread Bulat Ziganshin
Hello Don, Thursday, March 26, 2009, 8:26:18 PM, you wrote: >>> +RTS -c -F1.1 >> It now requires 386 MB of memory, but is 4.7 times slower. >> >> So, now memory required is about the same as the C++ version, but how >> can I optimize memory usage without having to tweak the garbage >> collect

Re: [Haskell-cafe] A bit of a shock - Memoizing functions

2009-03-27 Thread Bulat Ziganshin
Hello Gü?nther, Friday, March 27, 2009, 11:30:41 PM, you wrote: > Some of the memoizing functions, they actually "remember" stuff > *between* calls? what i've seen in haskell - functions relying on lazy datastructures that ensure computation on first usage so this looks exactly like as memoizing

Re: [Haskell-cafe] ANN: logfloat 0.12.0.1

2009-04-04 Thread Bulat Ziganshin
Hello wren, Saturday, April 4, 2009, 2:51:39 AM, you wrote: > On GHC 6.10 the use of -fvia-C had to be disabled because it conflicts > with the FFI (version 0.12.0.0 still used it, which is fine on GHC 6.8). > I'm still investigating the use of -fasm and getting proper benchmarking > numbers. Con

Re: [Haskell-cafe] System.Process.Posix

2009-04-04 Thread Bulat Ziganshin
Hello Cristiano, Sunday, April 5, 2009, 12:05:02 AM, you wrote: > Is it me or the above package is not included in Hoogle? afair, Neil, being windows user, includes only packages available for his own system there was a large thread a few months ago and many peoples voted for excluding any OS-s

Re: [Haskell-cafe] Questions about slow GC with STArray

2009-04-06 Thread Bulat Ziganshin
Hello FFT, Monday, April 6, 2009, 11:07:33 AM, you wrote: > this problem addressed there? Why is this supposed to be specific to > boxed arrays only: wouldn't GC have to scan the whole mutable array > whether it's boxed or unboxed? you need to scan only boxes: if array just contains plain cpu-le

Re[2]: [Haskell-cafe] Questions about slow GC with STArray

2009-04-06 Thread Bulat Ziganshin
Hello Dan, Monday, April 6, 2009, 12:35:14 PM, you wrote: > the size of the sub-array. The test then fills a 10 million element array. > However, something about the benchmark makes it perform poorly for both small > chunks and large chunks. -sstderr reports that lots of copying occurs for > sma

Re[2]: [Haskell-cafe] Questions about slow GC with STArray

2009-04-06 Thread Bulat Ziganshin
Hello FFT, Monday, April 6, 2009, 12:32:53 PM, you wrote: >> you need to scan only boxes: if array just contains plain cpu-level >> numbers, there is nothing to scan > Are those the only legal contents of STUArray? numbers, chars, vanilla pointers. UArray just mimics C arrays, after all -- B

Re[4]: [Haskell-cafe] Questions about slow GC with STArray

2009-04-06 Thread Bulat Ziganshin
Hello FFT, Monday, April 6, 2009, 12:56:51 PM, you wrote: >>> Are those the only legal contents of STUArray? >> >> numbers, chars, vanilla pointers. UArray just mimics C arrays, after all >> > I haven't gotten to learning about them in detail yet, but my hope was > that STUArray was like vector

Re: [Haskell-cafe] Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 2:25:12 PM, you wrote: > The problem I'm trying to solve is running system commands in > parallel. "system commands" means execution of external commands or just system calls inside Haskell? > Running a benchmark of issuing 1 million trivial tasks (create, >

[Haskell-cafe] Re[2]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 6:13:29 PM, you wrote: > Calls to System.Cmd.system, i.e. running external console processes. > It's a make system I'm writing, so virtually all the time is spent in > calls to ghc etc. > To Bulat: I should have been clearer with the spec. The idea is that > m

[Haskell-cafe] Re[3]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Bulat, Tuesday, April 7, 2009, 6:50:14 PM, you wrote: > tid <- forkIO (executing commands from chan...) > waitQSem sem > killThread tid > instead of killThread we really should send pseudo-job (like my > Nothing value) that will led to self-killing of job that gets this > signal > t

[Haskell-cafe] Re[2]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 6:13:29 PM, you wrote: > Consider a thread pool with 2 threads and the call parallel_ [parallel_ > [b,c],a] > You get the sequence: > enqueue (parallel_ [b,c]) > a > wait on parallel_ [b,c] > While you are executing a, a thread pool starts: > enqueue b > c >

[Haskell-cafe] Re[2]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 6:13:29 PM, you wrote: > Calls to System.Cmd.system, i.e. running external console processes. > It's a make system I'm writing, so virtually all the time is spent in > calls to ghc etc. btw, if all that you need is to limit amount of simultaneous System.Cmd.sy

[Haskell-cafe] Re[4]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 7:33:25 PM, you wrote: >> How about using unsafeInterleaveIO to get a lazy suspension of the result of >> each action, >> and then using par to spark off each of them? If that works you can reuse >> the existing >> task-parallel system of GHC to do the heavil

[Haskell-cafe] Re[4]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 7:33:25 PM, you wrote: > parallel_ (x1:xs) = do > sem <- newQSem $ 1 - length xs > forM_ xs $ \x -> > writeChan queue (x >> signalQSem sem, False) > x1 > addWorker > waitQSem sem > writeChan queue (signalQSem sem, True) > wai

[Haskell-cafe] Re[4]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Neil, Tuesday, April 7, 2009, 7:47:17 PM, you wrote: >> para = mapM_ forkIO > I might try that tomorrow and see if it makes a difference to the > performance. While the majority of computation is in system calls, > quite a few of the threads open files etc, and having them all run in > par

[Haskell-cafe] Re[5]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Bulat, Tuesday, April 7, 2009, 7:50:08 PM, you wrote: >> parallel_ (x1:xs) = do >> sem <- newQSem $ 1 - length xs >> forM_ xs $ \x -> >> writeChan queue (x >> signalQSem sem, False) >> x1 >> addWorker >> waitQSem sem >> writeChan queue (signalQSem sem, True)

[Haskell-cafe] Re[6]: Parallel combinator, performance advice

2009-04-07 Thread Bulat Ziganshin
Hello Bulat, Tuesday, April 7, 2009, 8:10:43 PM, you wrote: >>> parallel_ (x1:xs) = do >>> sem <- newQSem $ 1 - length xs >>> forM_ xs $ \x -> >>> writeChan queue (x >> signalQSem sem, False) >>> x1 >>> addWorker >>> waitQSem sem >>> writeChan queue (signalQSem sem

Re: [Haskell-cafe] Trying to write 'safeFromInteger'

2009-04-07 Thread Bulat Ziganshin
Hello Kannan, Wednesday, April 8, 2009, 1:27:21 AM, you wrote: > if i > (toInteger maxBound) problem here is that GHC doesn't know what maxBound you mean. is it maxBound::Int8? or maxBound::Word128? it has nothing common with the value you return later so you need to use either scoped type

[Haskell-cafe] Re[8]: Parallel combinator, performance advice

2009-04-08 Thread Bulat Ziganshin
Hello Neil, Wednesday, April 8, 2009, 2:33:15 PM, you wrote: > Yes, this saves us adding a kill job to the queue, but requires an > extra MVar. I guess which one of these is to be preferred depends on > performance measures. i think that main problem with your last variant is that kill job added

Re[2]: [Haskell-cafe] GHC needs a 64 bit machine to be fast?

2009-04-08 Thread Bulat Ziganshin
Hello Peter, Wednesday, April 8, 2009, 12:58:25 PM, you wrote: No. it seems that i'm only user asking GHC team for 64-bit version > Regarding that, is it possible to generate 64-bit code using GHC on Windows? > On Wed, Apr 8, 2009 at 10:17 AM, FFT wrote: > > On Wed, Apr 8, 2009 at 1:14 AM, K

Re[2]: [Haskell-cafe] Trying to write 'safeFromInteger'

2009-04-08 Thread Bulat Ziganshin
Hello Henning, Wednesday, April 8, 2009, 1:43:31 AM, you wrote: > i is Integer, so asTypeOf is not so easy to apply. I propose to write safeFromInteger i = let mb = maxBound in if i > (toInteger mb) then Nothing else Just (fromInteger i `asTypeOf` mb) or you can do it oppo

[Haskell-cafe] Re[10]: Parallel combinator, performance advice

2009-04-08 Thread Bulat Ziganshin
Hello Neil, Wednesday, April 8, 2009, 3:25:51 PM, you wrote: > I've attached a revised implementation. With my benchmark it gives a > stack overflow: it may be in replicate. check with let incRef = atomicModifyIORef r (\a -> (a,a)) > As a side note, it's necessary to add parallelStop, to kill

Re: [Haskell-cafe] Debugging compile times (Template Haskell)

2009-04-09 Thread Bulat Ziganshin
Hello Henning, Thursday, April 9, 2009, 5:01:21 PM, you wrote: i think that this case may be interesting for GHC developers > Hi, > as the author of the encoding package[1] I'm quite annoyed by the > extreeme long time it takes to compile a certain module (JISX0208). This > module uses template

Re[2]: [Haskell-cafe] Best text editor

2009-04-14 Thread Bulat Ziganshin
Hello Alexandr, Tuesday, April 14, 2009, 6:37:38 AM, you wrote: >> Hi I would like to follow the crowd and find out what text editor everyone >> uses for haskell on windows. > * HippoEdit (http://www.hippoedit.com/) i've tried HippoEdit and don't recommend it. it's work in progress so i immed

Re: [Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

2009-04-14 Thread Bulat Ziganshin
Hello rodrigo.bonifacio, Tuesday, April 14, 2009, 6:54:07 PM, you wrote: > I guess this is a very simple question. How can I convert IO > [XmlTree] to just a list of XmlTree? IO [XmlTree] is an action returning [XmlTree]. so to "convert" it to [XmlTree] you just need to execute it in IO monad:

win64 ghc version Re[4]: [Haskell-cafe] GHC needs a 64 bit machine to be fast?

2009-04-14 Thread Bulat Ziganshin
Hello Peter, Wednesday, April 8, 2009, 2:42:24 PM, you wrote: if you need win64 ghc version - add yourself to CC list of http://hackage.haskell.org/trac/ghc/ticket/1884 > Well, make that 2! :-) > On Wed, Apr 8, 2009 at 11:47 AM, Bulat Ziganshin > wrote: > Hello Peter, > >

Re[2]: [Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

2009-04-14 Thread Bulat Ziganshin
Hello Cristiano, Tuesday, April 14, 2009, 7:24:40 PM, you wrote: > unsafePerformIO is not "evil" by itself, it's there for a purpose and, > as for anything else in the language, it's better to understand when > to use it we just think that author of original question don't yet have good knowledg

Re: [Haskell-cafe] GHC including System.Time but not Data.Time?

2009-04-14 Thread Bulat Ziganshin
Hello John, Tuesday, April 14, 2009, 8:44:12 PM, you wrote: > I understand the goal of removing stuff from GHC, but the practical > implications can be rather annoying. i think that Haskell Platform will eventually replace what GHC was for a years, i.e. out-of-box solution for practical haskell

Re[2]: [Haskell-cafe] GHC including System.Time but not Data.Time?

2009-04-15 Thread Bulat Ziganshin
Hello John, Wednesday, April 15, 2009, 5:35:00 PM, you wrote: > I agree. Is there any chance of 6.10.3 reverting the change? both 6.6 and 6.8 had last releases at spring, so i don't expect new 6.10.* at all -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re[2]: [Haskell-cafe] ANN: Elerea, another FRP library

2009-04-16 Thread Bulat Ziganshin
Hello Peter, Thursday, April 16, 2009, 12:29:41 PM, you wrote: Lennart (and Patai) said about unsafePerformIO, you - about NOINLINE > Well, the documentation says: > Use {-# NOINLINE foo #-} as a pragma on any function foo that calls > unsafePerformIO. If the call is inlined, the I/O may be perf

Re[2]: [Haskell-cafe] RE: [Announce] primes

2009-04-17 Thread Bulat Ziganshin
Hello michael, Friday, April 17, 2009, 6:26:33 PM, you wrote: http://haskell.org/cabal/ > You're right. Since I'm not familiar with Cabal, I didn't use it. Is there a > good tutorial? Docs? > Also, I'm running a 32-bit Linux OS. Does one get a significant speed > increase by > switching to a

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Bulat Ziganshin
Hello Jason, Saturday, April 18, 2009, 1:41:18 AM, you wrote: > The algorithm should return the same result as: > sortProduct a b = sort [ x * y | x <- a, y <- b ] i think it's well-known problem. you should write a function merging infinite list of sorted lists. in assumption that lists are ord

Re: [Haskell-cafe] General function to count list elements?

2009-04-18 Thread Bulat Ziganshin
Hello michael, Saturday, April 18, 2009, 6:56:20 PM, you wrote: > Is there a general function to count list elements. I'm trying this you should add Eq restriction to type declaration since "==" operation belomngs to Eq class and your function may work only with types supporting comparision: co

Re[2]: [Haskell-cafe] General function to count list elements?

2009-04-18 Thread Bulat Ziganshin
Hello michael, Saturday, April 18, 2009, 8:27:45 PM, you wrote: so you can use Scheme to derive theorem proofs. useful for exams! :) > I know functions can be compared in Scheme > Welcome to DrScheme, version 4.1 [3m]. > Language: Swindle; memory limit: 128 megabytes. >> (equal? equal? equal?)

Re[2]: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Bulat Ziganshin
Hello R.A., Sunday, April 19, 2009, 11:46:53 PM, you wrote: > Does anybody know if there are any plans to incorporate some of > these extensions into GHC - specifically the existential typing ? it is already here, but you should use "forall" keyword instead odf "exists" -- Best regards, Bula

Re: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-20 Thread Bulat Ziganshin
Hello Jon, Monday, April 20, 2009, 1:59:07 PM, you wrote: > It's not an implementor's place to make such decisions -- > they can legitimately say "this feature sucks" and tell the > next Haskell committee so. If they care enough about it, > they can lobby or get on that next committee, but the >

Re[2]: [Haskell-cafe] CPS and the product function

2009-04-20 Thread Bulat Ziganshin
Hello michael, Monday, April 20, 2009, 6:32:47 PM, you wrote: something like 0*_ = 0 x*y = x *# y or vice versa _*0 = 0 x*y = x *# y where *# is original (*) definition. current ghc definiton just performs cpu-level operation w/o checking for 0 since this is rarely useful and need some time

Re[2]: [Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-21 Thread Bulat Ziganshin
Hello S., Tuesday, April 21, 2009, 5:42:15 PM, you wrote: > If we had been interested in raising fierce discussions about n+k > patterns or how and where cabal installs things, we could have easily > achieved the same effect with much less effort. you mean that we should shoot up? :) -- Best

Re[2]: [Haskell-cafe] Being impure within a 'pure' function

2009-04-22 Thread Bulat Ziganshin
Hello Jason, Wednesday, April 22, 2009, 1:14:49 PM, you wrote: there is no any need in unsafePerformIO for array computations - ST monad is exactly what one need here > If you want to do raw IO and repackage it as "pure", you can > use `unsafePerformIO` and friends. It is important to use th

Re: [Haskell-cafe] Issues with IO and FFIs

2009-04-22 Thread Bulat Ziganshin
Hello Jon, Wednesday, April 22, 2009, 1:54:58 PM, you wrote: > Does anyone have any comments on the following criticism of some difficulties > with FFI, including IO, in Haskell: > http://groups.google.com/group/comp.lang.functional/msg/6d650c086b2c8a49?hl=en > In particular, is it not always p

Re: [Haskell-cafe] Base version on Hackage?

2009-04-23 Thread Bulat Ziganshin
Hello Magnus, Thursday, April 23, 2009, 8:47:23 PM, you wrote: base is built-in into ghc/hugs/... it never can be on hackage > I'm not sure why building of my recently uploaded version of dataenc > fails to build on Hackage[1]. Where can I find out what version of base > is available on Hackage

Re: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Bulat Ziganshin
Hello Sam, Friday, April 24, 2009, 8:36:50 PM, you wrote: > I work in Games middleware, and am very interested in looking at how > Haskell could help us. We basically sell C++ libraries. I would like to > be able to write some areas of our libraries in Haskell, compile the > Haskell to C and inco

Re[2]: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Bulat Ziganshin
Hello Alex, Friday, April 24, 2009, 8:57:40 PM, you wrote: >> so, if you just need haskell-C++ interaction, you may look into using >> FFI [1,2]. if you believe that you can compile some >> java/ruby/haskellwhatever code down to C++ and incorporate it into >> your function - sorry, they all h

Re[2]: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Bulat Ziganshin
;t see that this would be unachievable, particularly given it's > generating C already. Have I missed something? > Cheers, > Sam > -Original Message- > From: Bulat Ziganshin [mailto:bulat.zigans...@gmail.com] > Sent: 24 April 2009 17:53 > To: Sam Martin > Cc: h

Re[4]: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Bulat Ziganshin
er a dozen compilers in > multiple languages, and my search ended with Timber. As I mentioned, > it is very young, it has very little standard library to speak of, but it has > strong possibilities. > > On Fri, Apr 24, 2009 at 1:34 PM, Bulat Ziganshin > wrote: >

Re[2]: [Haskell-cafe] compilation to C, not via-C

2009-04-25 Thread Bulat Ziganshin
Hello Sam, Saturday, April 25, 2009, 11:40:05 PM, you wrote: btw, are you seen MetaLua? it's pretty piece of software that makes Lua very FPish > > > Hi Ryan, > > Nice to hear from another games industry coder on the Haskell lists :) > > Thanks, this is exactly the kind of detail I

Re: [Haskell-cafe] Help from C libraries experts

2009-04-29 Thread Bulat Ziganshin
Hello Maurício, Wednesday, April 29, 2009, 11:09:04 PM, you wrote: > My goal is to have a place where one can find reliable and > comprehensive low-level bindings to foreign libraries, so that > writing higher level bindings becomes an easier task. it looks impractical. better will be to provide

Re: [Haskell-cafe] Decoupling OpenAL/ALUT packages from OpenGL

2009-05-02 Thread Bulat Ziganshin
Hello Sven, Saturday, May 2, 2009, 9:14:13 PM, you wrote: > must, but the actual packaging is not nice. So the obvious idea is to > introduce 3 new packages which lift out functionality from the OpenGL package: another possible variant: OpenGL-DataTypes package that joins these 3 -- Best rega

Re: [Haskell-cafe] using haskell for a project

2009-05-03 Thread Bulat Ziganshin
Hello Nicolas, Saturday, May 2, 2009, 9:17:55 PM, you wrote: > But now I don't know how to dynamically add new spells (new spells can be > created in my gameplay). Since I can't assign a new value to the `spells' > variable (Data.Map.insert returns a new map), I just don't know where to > go. we

Re: [Haskell-cafe] Haskell vs Clean (speed comparison)

2009-05-03 Thread Bulat Ziganshin
Hello Daniel, Sunday, May 3, 2009, 10:24:52 PM, you wrote: > 32-bit sing core [1]: Lisp, Fortran :) this test measures speed of some programs, not "languages". results are depends mainly on bundled libraries and RTS. by no means it demonstrates speed of compiler-generated code of carefully-writ

<    1   2   3   4   5   6   7   8   9   10   >