[m-dev.] FYI: cell cache

Ralph Becket rbeck at microsoft.com
Fri Sep 29 02:12:11 AEDT 2000


>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.

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.

Ralph

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 

--------------------------------------------------------------------------
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