[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

[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 heavily lifting

[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) waitQSem sem

[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 parallel

[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) waitQSem sem

[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, True) waitQSem sem

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

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 small

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 -- Best

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 vectorT in C++,

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.

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

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] 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 collector? You'll

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.com

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 allb...@ece.cmu.edu On

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

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, i

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

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 versions?

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 the

[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] 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 own

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, everything

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

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

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

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

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] 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

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 the

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.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[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

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 I

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 is

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? :) -- Best

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) -- Best

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

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 copying

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 return $!

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, Bulat

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

2009-03-03 Thread Bulat Ziganshin
(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 PM, you wrote: anybody give me

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

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

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 collector

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. I

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

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 the

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 handle

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 every

Re[4]: [Haskell-cafe] Re: Incremental array updates

2009-02-27 Thread Bulat Ziganshin
Hello Eugene, Thursday, February 26, 2009, 10:28:13 PM, you wrote: Thanks, I'll have a look at these. Treating unboxed stuff polymorphically is anyways very interesting and would be good to use in collections API that has been recently discussed (and which I occasionally try to continue

Re[6]: [Haskell-cafe] Re: Incremental array updates

2009-02-27 Thread Bulat Ziganshin
Hello Eugene, Friday, February 27, 2009, 4:42:03 PM, you wrote: I'm exactly basing on them, but they don't have at least these things: them means Edison or Collections typeclasses? - Treatment for unboxed types (I don't know yet, whether it is needed; but why do STUArrays have special

Re: [Haskell-cafe] Trouble building ArrayRef 0.1.3

2009-02-27 Thread Bulat Ziganshin
Hello Mads, Friday, February 27, 2009, 6:27:52 PM, you wrote: i made this lib back in the ghc 6.4 days, so it probably have a lot of compatibility problems here and there :( i'm self still use ghc 6.6 :) When I try to build ArrayRef 0.1.3 I get: Control/Concurrent/LockingBZ.hs:159:54:

Re[2]: [Haskell-cafe] Trouble building ArrayRef 0.1.3

2009-02-27 Thread Bulat Ziganshin
Hello Mads, Friday, February 27, 2009, 10:08:17 PM, you wrote: http://haskell.org/haskellwiki/Upgrading_packages is more appropriate, see 2.3 Hi For anyone who may care, I have googled a workaround. The problem below is similar to the problem mentioned here

Re: [Haskell-cafe] Re: Incremental array updates

2009-02-26 Thread Bulat Ziganshin
Hello Daniel, Thursday, February 26, 2009, 9:27:10 PM, you wrote: It was about this: I needed to generate all possibilities for some combinations and each of those had a numeric property, say from 1 to 1; I then had to count how many of the possibilities were of a given category. So I

Re[2]: [Haskell-cafe] Re: Incremental array updates

2009-02-26 Thread Bulat Ziganshin
Hello Ross, Thursday, February 26, 2009, 9:54:23 PM, you wrote: the same loop using STArray, but accumArray provide you pure API for such computations And accumArray can also be used with UArray if laziness is a problem. to be exact, for Array, STArray used internally for

Re[2]: [Haskell-cafe] Re: Incremental array updates

2009-02-26 Thread Bulat Ziganshin
Hello Eugene, Thursday, February 26, 2009, 5:32:14 PM, you wrote: look at http://haskell.org/haskellwiki/Library/ArrayRef it contains reimplementation of arrays library according to OlegSimon idea: - Unboxed arrays now can be used in polymorphic functions, they are defined for every element

Re[2]: Pickling a finite map (Binary + zlib) [was: [Haskell-cafe] Data.Binary poor read performance]

2009-02-24 Thread Bulat Ziganshin
Hello Felipe, Tuesday, February 24, 2009, 11:24:19 AM, you wrote: Too bad 'Map' is exported as an abstract data type and it's not straighforward to test this conjecture. Any ideas? just make a copy of its implementation to test btw, i always thought that it should be a way to overcome any

Export restrictions :) Re[4]: Pickling a finite map (Binary + zlib) [was: [Haskell-cafe] Data.Binary poor read performance]

2009-02-24 Thread Bulat Ziganshin
Hello Svein, Tuesday, February 24, 2009, 3:47:44 PM, you wrote: btw, i always thought that it should be a way to overcome any export lists and go directly to module internals. limiting export is the way to protect programmer from errors, not security feature, and it should be left to

Re[2]: Pickling a finite map (Binary + zlib) [was: [Haskell-cafe] Data.Binary poor read performance]

2009-02-23 Thread Bulat Ziganshin
Hello Duncan, Tuesday, February 24, 2009, 5:13:05 AM, you wrote: That's actually rather surprising. The system time is negligible and the yes, this looks highly suspicious. we use 1.5 seconds for 1.3 mb file, and 0.3 seconds for 0.3 mb file, so it looks like readFile monopolize cpu here, being

Re: [haskell-cafe] Finding a PID in Windows

2009-02-22 Thread Bulat Ziganshin
Hello Alexandru, Sunday, February 22, 2009, 7:38:31 PM, you wrote: In Linux, if you want to find the PID of a process, you use getProcessID from The GetCurrentProcessId function returns the process identifier of the calling process. DWORD GetCurrentProcessId(VOID) you need to make FFI

Re: [Haskell-cafe] Showing 100% CPU usage of parallel code

2009-02-21 Thread Bulat Ziganshin
Hello Jim, Saturday, February 21, 2009, 6:17:54 PM, you wrote: main = a `par` b `par` c `pseq` print (a + b + c) two things: 1) that are grouping order? may be, a `par` (b `par` (c `pseq` print (a + b + c))) ? 2) i recommend you to use 2 *same* computations. otherwise, it's easily possible

Re: Fwd: Re: [Haskell-cafe] speed: ghc vs gcc

2009-02-21 Thread Bulat Ziganshin
Hello Khudyakov, Sunday, February 22, 2009, 12:58:59 AM, you wrote: you could even pass it in a test data set to which it must be optimized; after the program is compiled, the compiler runs and profiles it, measures the results, and does another pass to make it faster. it supported in gcc4

Re[3]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-21 Thread Bulat Ziganshin
Hello Louis, Saturday, February 21, 2009, 4:16:10 AM, you wrote: In the meantime, a brief summary: a minor correction: the best gcc result shown in the thread was 50x faster than Don's one, so you need to miltiple all ratios by a factor of 50 Straightforward and simple Haskell code, written

Re[5]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-21 Thread Bulat Ziganshin
at 5:21 PM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Louis, Saturday, February 21, 2009, 4:16:10 AM, you wrote: In the meantime, a brief summary: a minor correction: the best gcc result shown in the thread was 50x faster than Don's one, so you need to miltiple

Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-21 Thread Bulat Ziganshin
Hello Daniel, Sunday, February 22, 2009, 2:36:57 AM, you wrote: You're referring to the freak result of Dan Doel? Come on, be serious, please. I have a Haskell result that runs in 7ms, too. Just use a rewrite rule and hey presto :) Dan, why you have not said the same about test where ghc

Re[7]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-21 Thread Bulat Ziganshin
Hello Sebastian, Sunday, February 22, 2009, 2:55:38 AM, you wrote: yes, you are right. Don also compared results of 64x-reduced computation with full one. are you think that these results are more fair? Yes. Clearly so. It still computes the result from scratch - it just uses a trick

Re[7]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-21 Thread Bulat Ziganshin
wasserman.lo...@gmail.com On Sat, Feb 21, 2009 at 5:55 PM, Sebastian Sylvan syl...@student.chalmers.se wrote: On Sat, Feb 21, 2009 at 11:35 PM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Louis, Sunday, February 22, 2009, 2:30:23 AM, you wrote: yes, you are right

[Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello haskell-cafe, since there are no objective tests comparing ghc to gcc, i made my own one. these are 3 programs, calculating sum in c++ and haskell: main = print $ sum[1..10^9::Int] main = print $ sum0 (10^9) 0 sum0 :: Int - Int - Int sum0 0 !acc = acc sum0 !x !acc = sum0 (x-1) (acc+x)

Re[2]: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Miguel, Friday, February 20, 2009, 4:48:15 PM, you wrote: Ahem. Seems like you've included time spent on the runtime loading. for C, i've used additional 100x loop sys 0m0.002s sys 0m0.017s While 3.201 vs. 0.066 seem to be a huge difference, 0.017 vs. 0.002 is not that bad.

Re[2]: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Dan, Friday, February 20, 2009, 5:39:25 PM, you wrote: Not that I'd be sad if GHC could reduce that whole constant at compile time, but GCC isn't doing 1 billion adds in 6 (or even 60) milliseconds. yes, that's what was done actually: 22 0020 8D44D01C leal

Re: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Achim, Friday, February 20, 2009, 5:44:44 PM, you wrote: Nice! Now we know that gcc can calculate faster than Haskell can calculate and print. Next time, use exitWith, please. it was done in order to simplify sources. are you really believe that ghc needs more than 1 millisecond to

Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Peter, Friday, February 20, 2009, 6:18:50 PM, you wrote: So GHC is about 3 to 4 times slower as Visual C++ / GCC without loop unrolling why stop on disabling loop unrolling? there are lot of options we can use if we want to make gcc slower :D -- Best regards, Bulat

Re: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Achim, Friday, February 20, 2009, 6:25:31 PM, you wrote: it was done in order to simplify sources. are you really believe that ghc needs more than 1 millisecond to print one number? :) Well, I know that (Show a) is about as slow as you can get. yes, but it's printed only once against

Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Peter, Friday, February 20, 2009, 6:34:04 PM, you wrote: Well C# does it with a for loop in 2300ms, and when using a IEnumerable sequence it needs 19936ms. Very much like the Haskell code. But of course the Haskell code could optimize the sum I guess, I assume it is using the lazy

Re[2]: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello David, Friday, February 20, 2009, 6:52:03 PM, you wrote: In Haskell you're printing it... why not print it in C++? in order to omit #include stdio line -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___

Re[2]: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Don, Friday, February 20, 2009, 7:41:33 PM, you wrote: main = print $ sum[1..10^9::Int] This won't be comparable to your loop below, as 'sum' is a left fold (which doesn't fuse under build/foldr). You should use the list implementation from the stream-fusion package (or uvector) if

Re[4]: [Haskell-cafe] speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Friday, February 20, 2009, 8:22:33 PM, you wrote: doesn't matter for testing speed okay then, I wrote a faster Haskell version: main = print Hello world for you, any language will be fast enough :D -- Best regards, Bulat

Re[4]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Claus, Friday, February 20, 2009, 11:15:59 PM, you wrote: Turning this into a ticket with associated test will: but why you think that this is untypical and needs a ticket? ;) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Achim, Friday, February 20, 2009, 11:44:49 PM, you wrote: Turning this into a ticket with associated test will: but why you think that this is untypical and needs a ticket? ;) Bulat, you are right in every aspect. You never did anything wrong. Achim, this is simplest code one can

Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Manlio, Saturday, February 21, 2009, 12:54:00 AM, you wrote: ghc -O2 naive left fold15.680 As a full comparison I would like to see time for ghc -O0 naive left fold he is still waiting :))) but that's really has only theoretical interest, comparing ghc -O2 on

Re: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Achim, Saturday, February 21, 2009, 12:54:33 AM, you wrote: so - why YOU think that ghc generates fast code and this example is something unusual? I think ghc has decent performance, and that there's room for improvement. I don't care whether you compare it to gcc, i'm asking

Re: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Achim, Saturday, February 21, 2009, 1:17:08 AM, you wrote: nothing new: what you are not interested in real compilers comparison, preferring to demonstrate artificial results ...that we have a path to get better results than gcc -O3 -funroll-loops, and it's within reach... we even can

Re[4]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Saturday, February 21, 2009, 1:19:47 AM, you wrote: I'm not sure what you're getting at Bulat √ it's been demonstrated that ghc is slower than gcc for most cases at the moment (many benchmarks will back this up), *however*, it's also easily verified that ghc has had

Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello John, Saturday, February 21, 2009, 1:33:12 AM, you wrote: Don't forget jhc: i was pretty sure that jhc will be as fast as gcc :) unfortunately, jhc isn't our production compiler -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Saturday, February 21, 2009, 1:41:24 AM, you wrote: You need look no further than the debian language shootout that things really aren't as bad as you're making out √ Haskell comes in in general less than 3x slower than gcc compiled C. you should look inside these tests, as i

Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Saturday, February 21, 2009, 1:41:24 AM, you wrote: so, again: this confirms that Don is always build artificial comparisons, optimizing Haskell code by hand and ignoring obvious ways You need look no further than the debian language shootout that things and yes - this is the

Re[4]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Saturday, February 21, 2009, 1:52:27 AM, you wrote: i was pretty sure that jhc will be as fast as gcc :) unfortunately, jhc isn't our production compiler Why not? There's nothing stopping you from choosing any Haskell compiler you like. If jhc gives you the performance you

Re[4]: [Haskell-cafe] Re: speed: ghc vs gcc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Saturday, February 21, 2009, 1:55:33 AM, you wrote: most of these tests depends on libraries speed. in one test, PHP is 1st. from 2 or 3 tests that depends on compiler speed, one was fooled by adding special function readInt to ghc libs and the rest are written in low-level

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