[erlang-questions] data sharing is outside the semantics of Erlang, but it sure is useful

Richard O'Keefe ok@REDACTED
Thu Sep 17 08:00:34 CEST 2009


On Sep 17, 2009, at 2:46 PM, Witold Baryluk wrote:
> It is quite strange to anybody, that for example time complexity
> (and memory also as sharing is lost) of algorithm are different in
> situations:
>
> 1) we built data structure D, and execute algorithm a(D)
> 2) we build data structure D, send it to P, which then executes a(D).

My message explicitly said that I thought that Erlang should
*PRESERVE* sharing, including in message passing.  You didn't
need to persuade me of something I already argued for.

The point at issue, as I understood it, was an "OPTIMIZATION",
namely INTRODUCING sharing.  For example, if memory serves me
correctly, whenever the Logix implementation of Flat Concurrent
Prolog successfully executed a test X == Y, it smashed one of
them to refer to the other.  That's run-time introduction of
sharing.  The reason why Logix did that was that they didn't
_have_ atoms, only strings, in order to avoid having to lock
a centralised symbol table.  But they wanted strings to _act_
rather like atoms.

I recommend
				within a     during message
				process      passing
	preserve sharing        YES[1]       YES[2]
	introduce sharing       NO           NO

[1] This is what Erlang does now.
[2] This is a change, and it's going to be tricky to do it
     without slowing "normal" cases down.
     And I'm counting term_to_binary/binary_to_term here,
     because of their use when messages are passed over a wire.





More information about the erlang-questions mailing list