[Haskell-cafe] Re: Efficient Factoring Out of Constants

Luke Palmer lrpalmer at gmail.com
Sat Jan 17 11:55:27 EST 2009

On Sat, Jan 17, 2009 at 9:46 AM, Phil <pbeadling at mail2web.com> wrote:

>  In the second example we probably have something like 6 'JMP' statements
> in machine code – 3 to jump in to each function, and 3 to jump back out.  In
> the first we have 2 – one to jump us into mcSimulate and one to return.  So
> each iteration executes 4 more JMPs in the second example.  All others
> things being equal this will produce slightly less efficient code.

Wow.  I strongly suggest you forget about efficiency completely and become a
proficient high-level haskeller, and then dive back in.  Laziness changes
many runtime properties, and renders your old ways of thinking about
efficiency almost useless.

If you are interested, though, you can use the ghc-core tool on hackage to
look at the core (lowish-level intermediate language) and even the generated
assembly for minimal cases.  It's dense, but interesting if you have the
time to study it.

Others will know more about this specific speculation than I.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090117/798c4336/attachment-0001.htm

More information about the Haskell-Cafe mailing list