[m-dev.] FYI: cell cache
Peter Ross
petdr at miscrit.be
Fri Sep 29 02:26:29 AEDT 2000
On Thu, Sep 28, 2000 at 08:12:11AM -0700, Ralph Becket wrote:
> >From Peter Ross on 28/09/2000 15:29:12
> >
> > io__read_word_2 is an example of a bit of code that should benefit from
> > the cell cache. Each call to read_char creates an ok/1 cell, which is
> > promptly consumed and become dead. The cell cache allows the same cell
> > for ok/1 to be reused in the next call to io__read_char.
> >
> > This optimization provides about a 5% speed up on a simplified version
> > of io__read_word_2.
> >
> What optimization level did you use? The compiler can do a fair job of
> deforestation in the sense of avoiding structure creation where said
> structure is immediately unpacked and discarded.
>
An optimization level which didn't deforest the intermediate cell
creation. I was just interested in making sure that the overhead of the
cache didn't outweigh the benefits of using the cache.
> When I did the SPEC benchmark experiment, I had something like
>
> io__read_char(Result),
> ( { Result = ok(Char) }, ...
> ; { Result = eof }, ...
> ; { Result = error(Err) }, ...
> )
> which, with intermodule optimization enabled (IIRC), resulted in code
> that did no memory allocation at all.
>
> Note that this isn't a criticism of the cell cache idea (haven't thought
> about it enough), but rather a comment about the motivating example.
>
I wasn't sure if it would be a win, but it appears that it can be.
Pete
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list