geometric memory growth

Thomas Lindgren <>
Sat Dec 3 13:31:44 CET 2005



--- "Ulf Wiger (AL/EAB)" <>
wrote:

> Thomas Lindgren wrote:
> > ...
> ...
> I don't know if that qualifies as cheap enough.

In conventional compilers, "cheap enough" is
individual instructions with latencies on the order of
a few cycles. (Changing a loop iteration by a single
cycle can yield visible differences there.) For
high-level languages, I guess we are still sounding
out the terrain.

(If one looks at competing SML compilers, for example,
they still seem to vary in performance by big factors
on different benchmarks.)

> To make my point clearer, I think this particular
> behaviour should be documented _somewhere_. 

Yes, basically it should be made clear that the
variables bound outside and used inside (AND not
shadowed :-) will be passed around with the fun as the
fun environment. (Aka lexical scoping.)

> - During message passing, not only does the runtime
>   system copy the data - it expands all relative 
>   references into individual copies (I knew this 
>   happened when sending between nodes, but hadn't 
>   considered that it also might happen during 
>   local message passing.)

A somewhat nasty issue.

> To boot, the "bug" was very difficult to spot, /.../

Maybe there should be some way to determine the "size"
of a closure and the amount of memory copied when a
message is passed (e.g., in the process info)?

> Opinions may vary, but as a representative of a 
> project that builds resonably performance-critical
> software in Erlang, I would still rather take 
> a very slight performance hit in order to have
> a treatment of a reasonably commonplace pattern
> that works wonderfully 99.9% of the time, and 
> kills the system if someone has the bad luck
> of passing the variable in a message (perhaps
> as part of a debug printout.)

Do ensure that the optimization is not "brittle" in
that case: that it performs well in a variety of
situations, and that it is well-known why it occurs or
not. And that you can see what's killing the system
when you turn out to be the thousandth one, and
preferrably can do something about it.

Best,
Thomas



		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 




More information about the erlang-questions mailing list