Implementing tables - advice wanted

Richard Carlsson richardc@REDACTED
Tue Jun 13 12:30:21 CEST 2006


Joe Armstrong (AL/EAB) wrote:
> Erlang really really really (^100) needs tables.

Allow me to disagree somewhat. Erlang already has good tables,
both using hashing (dict) and binary trees (gb_trees). The
syntactic convenience of a built-in table/dictionary type is
really a minor thing. (Not that I would oppose having such a
notation, but I really don't think it is critical in any way.)
The main advantage would be psychological, I think: a standard
one-size-fits-all dictionary type makes it easier for people to
start using them in public interfaces, and not just internally.

What I _do_ miss now and then (and when I need them, I have to
jump through several hoops to get them) is indexable tables
(i.e., arrays) with O(1) access time and a _small_ constant
factor, and no copying of the stored data.

If I remember correctly, the experiment with a "vector" data
type (which used destructive update internally, with some
penalty for accessing older versions of the data) was killed
by bad interaction with the garbage collector, leading to
rotten performance. Have things changed enough in the GC by
now for this to become worth a new attempt?

	/Richard




More information about the erlang-questions mailing list