[erlang-questions] Performance of matches

David Lloyd <>
Sat May 31 12:22:26 CEST 2008


Darren,

Darren New wrote:
> Speaking of table-driven decisions...
> 
> Is a function like this efficiently matched?
> 
> table1("hello") -> ...;
> table1("byebye") -> ...;
> table1("morning") -> ...;
>    ... and so on for dozens more ...
> 
> How about
> table2(hello) -> ...;
> table2(byebye) -> ...;
> table2(morning) -> ...;
>     ... And so on for dozens more ...
> 
> Is either of those O(1) lookup time?

It strikes me that this is something that is eminently easy to profile...

DSL



More information about the erlang-questions mailing list