[erlang-questions] Performance of matches

Darren New dnew@REDACTED
Sun Jun 1 01:15:07 CEST 2008


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. Altho compiling a function matching against one of 100,000 
atoms did take 20 minutes. :-)   It looks like even matching atoms[*] 
takes O(lg n) time.  I'll have to see if ets does any better.


[*]
func(x1) -> 1;
func(x2) -> 2;
   ...


(Sorry you got this twice, David.)

-- 
   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."



More information about the erlang-questions mailing list