Arrays and tuple write (setelement) optimization

Sean Hinde Sean.Hinde@REDACTED
Mon Jul 9 00:40:15 CEST 2001


> One problem is that it is very sensitive to keeping old references
> around, the update operations can become quite costly in both time and
> space.  Björn tested my dict implementation, which tries to be smart
> by heavily reusing tuples, and it apparently went slower with vectors.

But I seem to remember reading that this slowness was more due to the
fullsweep garbage collection which is currently done along with every update
rather than anything fundamental about vectors.

> The first is more efficient, but the second preserves Erlang semantics
> for terms.
> 
> A datatype like this would be useful, I suppose it is just a matter of
> deciding what you want.  Having both would a Bad Thing!

Definitely agreed it would be useful. My vote would be for Vectors on the
basis that they would make dealing with catch/exception situations much
easier and cleaner than totally destructive updates.. 

but if this is at the cost of significantly slowing down the whole runtime
with slower garbage collection or some other side effect then I guess
destructive updates would be fine. People are used to ets destructive
semantics after all.

- Sean



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.




More information about the erlang-questions mailing list