[Haskell-cafe] Question about STRef

Michael Snoyman michael at snoyman.com
Thu Jan 26 13:15:44 UTC 2017


On Thu, Jan 26, 2017 at 3:05 PM, Johannes Waldmann <
johannes.waldmann at htwk-leipzig.de> wrote:

> What Michael did not mention in the mail, but it's in his code:
> numerals defaulted to Integer, and the story changes (somewhat)
> if we force Int.
>
> I updated my measurements:
> http://www.imn.htwk-leipzig.de/~waldmann/etc/mob/
> and ghc-8 looks better now - but not quite wins.
>
> > there's still some more low hanging fruit here
>
> ... for whom? What could we reasonably expect of the compiler here?
> It could do the strictification? the unboxing?
>
> It certainly could not replace Integer by Int,
> since the range of numerical values has no obvious bound.
>
> But then, all these Integers are small, but we pay quite an overhead
> (for represeting Int as Integer) which has increased for current ghcs?
>
>
I meant that, if someone wanted to bring down allocations significantly, I
would think there's still room for optimization. I was not commenting on
what GHC should or shouldn't be capable of doing here. It would certainly
be nice, for example, if it was capable of noticing the strictness involved
and automatically unbox the STRefs, but that would be quite a feat.

I didn't investigate further myself, so I could be mistaken about the
possibility to further reduce allocations. It was just a guess (thus the "I
think").

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170126/8a9b7047/attachment.html>


More information about the Haskell-Cafe mailing list