[erlang-questions] Performance of matches
Tue Jun 3 22:19:43 CEST 2008
2008/6/3 Richard Carlsson <>:
> Rapsey wrote:
> > Actually there is an array:
> > http://erlang.org/doc/man/array.html
> > It was added in R12B I think.
> Yes, but it is a purely functional data structure,
> and still has O(log n) access time, although with a
> much better constant factor than dict or gb_trees.
The only O(1) data structure I know of in Erlang are ETS and dict, though as
Richard says the constant factor is higher. Which method you choose is of
course entirely dependent on your problem. Fortunately the interfaces to
dict, array are gb_trees sufficiently alike so that you can hide them in
macros to facilitate testing and comparing. You can do it with ets but it
takes a little more fiddling.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions