Try adding strictness annotations to all the components of all your
data structures (i.e. put a ! before the type). Not all of the need
it, but I doubt any need to be lazy either. Probably the reason
quant8 seems to be taking so much time is that it is where a lot of
stuff finally gets forced. Certainly, for things that are "primitive"
like Colour and Vector you want the components to be strict, in general.
Yes, originally the profile was showing quant8 taking something absurd
like 80% of the CPU time. When I changed the framebuffer to an IOUArray,
the time spent in quant8 dropped *drastically*. (Because now the
framebuffer is strict, and that's forcing the evaluation sooner.)
I could certainly try making vectors, colours and arrays strict and see
if that does something... (Thinking about it, the colour computation has
a square root in it, and I bet that doesn't get forced until it hits
quant8... Square root is an expensive operation on currentl hardware
isn't it?)
Also, you have many many superfluous parentheses and use a different
naming convention from representative Haskell code (namely camelCase).
This is a pet hate of mine. NamesLikeThis are fine. names_like_this are
fine too. But for the love of God, namesLikeThis just looks stupid and
annoying! So I generally use camel case for stuff which has to start
uppercase, and underscores for stuff that has to start lowercase. It's a
system, and it works. Unfortunately it's not the standard convention in
Haskell. (And I doubt I will convince anybody to change it...)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe