strict bits of datatypes

Adrian Hey ahey at iee.org
Wed Mar 21 18:38:29 EDT 2007


Excuse me for moving this discussion over to ghc users.

(On Haskell prime) John Meacham wrote:
> Although I have not looked into this much, My guess is it is an issue in
> the simplifier, normally when something is examined with a case
> statement, the simplification context sets its status to 'NoneOf []',
> which means we know it is in WHNF, but we don't have any more info about
> it. I would think that the solution would be to add the same annotation
> in the simplifier to variables bound by pattern matching on strict data
> types?
> 
> Just a theory. I am not sure how to debug this in ghc without digging
> into it's code.

Well the latest on this is I've sent Simon some code which illustrates
the problem, but it seems not quite as simple as I first speculated, in
that a simple function that just overwrites tree elements takes exactly
the same time whether I rely on strictness annotations or explicit
seqs (something I would not expect if my original speculation was
correct).

But a more complex function that does insertions into the tree takes
about 15% longer using strictness annotations than it does with
explicit seqs. The object file seems quite a bit larger too.

BTW, I suspect one (perhaps the only) reason for the apparent jump
from 5% longer (as stated in my earlier post) to 15% is that I
modified the test so less time would be spent on garbage collection,
thereby amplifying the apparent difference in speeds.

I can post the relevant code to anyone who's interested and thinks
they might be able to explain this. I guess the next step would be
for someone who understands core to take a look at it. I'm afraid
I find core incomprehensible :-(

Regards
--
Adrian Hey



More information about the Glasgow-haskell-users mailing list