[erlang-questions] Performance of matches

Rapsey <>
Tue Jun 3 06:12:46 CEST 2008


Actually there is an array:
http://erlang.org/doc/man/array.html

It was added in R12B I think.




On Mon, Jun 2, 2008 at 11:15 PM, Darren New <> wrote:

> Darren New wrote:
> > David Lloyd wrote:
> >  >> Is either of those O(1) lookup time?
> >  > It strikes me that this is something that is eminently easy to
> profile...
> >
> > Good point.
>
> Actually, I was asking a slightly more complex question. It's only easy
> to profile if the compiler doesn't have special cases that make some
> things faster. For example, Haskell has enough smarts to notice some
> operations never look at the unmodified value after you modify it, and
> use that to avoid copying the whole collection (for example) when you
> modify one element. Much the same way I've read Erlang avoids copying
> binaries when you append to them in certain circumstances.
>
> So, basically, I was trying to ask the question "is there any O(1) data
> structure in Erlang, such as a hashtable or an array equivalent?" Maybe
> it just hasn't clicked for me, is all.
>
> Good to know the process dictionary is actually a hashtable, but there's
> only one per process and they don't nest, so that's pretty limited. Plus
> there are recommendations to avoid it, for some reason that isn't
> explained.
>
> --
>   Darren New / San Diego, CA, USA (PST)
>     "That's pretty. Where's that?"
>          "It's the Age of Channelwood."
>     "We should go there on vacation some time."
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080603/a5868508/attachment.html>


More information about the erlang-questions mailing list