[mercury-users] Tagged datatypes and boxing

Ralph Becket rbeck at microsoft.com
Fri Sep 24 01:46:36 AEST 1999


Yes, I thought it might be a an epic task.

For the record, I recoded my two predicates so that they returned two values
rather than one.  The first return value is a `status' indicator (i.e. an
argless version of the original constructor) and the second one was the arg
itself.

Now: no allocation (apart from three or four calls to tree234 in the Mercury
startup code, and that I suspect is an artifact of running with Profiling
on.)
It's also nearly doubled the runtime performance of the code.  This is
clearly
a powerful optimisation!

BUT!  Whoa!  I've just taken a second look at my code and it's using
io__read_byte//1 which returns an io__result(int), which has *three*
different
constructors.  However, running this with memory-profiling doesn't reveal
anything about this.  The only thing I get is from the output of
report_stats/0 at the end of my main//0 which tells me I've used a few
hundred
kbytes (in fact, for a large test run, it tells me I've used -880 mbytes,
which
looks like a buglet.)

So it seems I can't get away from this stuff at all!  Not that it matters
too
much since (1) the SPEC benchmark is run over arrays in memory and (2) this
is
a slightly silly test since just one look at the C convinces you that it's
the
Wrong Thing To Use.  But systems people can be hard to convince...

Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list