geometric memory growth

Ulf Wiger (AL/EAB) <>
Sun Nov 27 16:58:42 CET 2005


Pascal Brisset wrote:

>  > Isn't this basically an example of constant propagation?
> 
> Constant propagation should be safe, but it is only a subset.

Ok, the discussion seems to be drifting away from the
original question, which dealt specifically with 
record field access. It isn't so much computation,
as it is a pointer reference. The question is whether
one always has to bind the entire record, or simply 
bind the record field into the fun's environment.
In order to do this, one doesn't need to evaluate the
fun itself. 

> It may still interfere with benchmarks where people expect 
> computations to take place in a specific context.
> Lambda-calculists would see the general case as "reducing 
> under the lambda".
> 
> Consider also the case where f(B) loops infinitely.

The current method certainly interfered with my benchmark,
since it caused the whole workstation to become unresponsive
almost immediately.  ;-)

Specifically for record field access, the reference manual
doesn't really specify that it should reduce exactly to
an element/2 call. In the old days, it used to expand
into a pattern match, if I recall correctly. I don't think
one should, or even could reason about benchmark performance
at that level in Erlang.

> Lambda-calculists would see the general case as "reducing 
> under the lambda".

Ah, thanks.

> Side effects are obviously a concern (including exceptions).

But not for record field access, since there are no
side-effects associated with those. 

/uffe



More information about the erlang-questions mailing list