[Haskell-cafe] Code review: efficiency question

Josef Svenningsson josef.svenningsson at gmail.com
Wed May 3 06:15:09 EDT 2006


You might also want to take a look at the list fusion functionality in
GHC which often can help optimize your programs when programming with
It doesn't help in your particular program but it might be usable for
you in the future.



On 5/3/06, Brian Hulley <brianh at metamilk.com> wrote:
> Bulat Ziganshin wrote:
> > [ideas including reverseMapM_]
> > you will laugh, but speed of your two solutions depends on so many
> > factors (including size of CPU cache) that noone can say that is
> > better in general. although for small lists reverseMapM_ should be
> > faster than reverse+mapM. what will be faster - using of higher-order
> > function or direct recursion, i can't say, it's a really
> > counter-intuitive area of ghc optimizer :)
> >
> > of course, i don't think that all that really matters for your program
> > (drawing should anyway need much more time than looping). just use
> > higher-level approach (that makes code simpler to write, understand
> > and maintain) and don't bother your mind :)
> Hi Bulat!
> Thanks for the suggestions about reverseMapM_ etc.
> It seems that since the speeds of the two solutions can be relatively
> faster/slower on different platforms/CPUs I might as well just use the
> combination of existing functions mapM_ and reverse at the moment to get
> readable code with the least amount of effort :-)
> Best regards, Brian.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list