[Haskell-cafe] announce: Glome.hs raytracer

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Mar 26 18:09:47 EDT 2008


Hello Jim,

Thursday, March 27, 2008, 12:33:20 AM, you wrote:

> -Multi-core parallelism is working, but not as well as I'd expect: I get
> about a 25% reduction in runtime on two cores rather than 50%.  I split

this may be an effect of limited memory bandwidth

> -Memory consumption is atrocious: 146 megs to render a scene that's a

standard answer: ByteString

> -Collecting rendering stats is not easy without global variables.  It
> occurs to me that it would be neat if there were some sort of write-only
> global variables that can be incremented by pure code but can only be 
> read from within monadic code; that would be sufficient to ensure that
> the pure code wasn't affected by the values.

the code is called *pure* exactly because it has no side-effects and
compiler may select either to call some function two times or reuse
already computed result. actually, you can make sideeffects with
unsafePerformIO, but there is no guarantees of how many times such
code will be executed. try this:

plus a b = unsafePerformIO (modifyIORef counter (+1)) `seq` a+b


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list