[erlang-questions] Is function clause selection O(n)?
Wed Jul 18 11:04:04 CEST 2007
2007/7/18, Joe Armstrong <>:
> Basically I wouldn't out-guess the compiler. Try using clauses even if there are
> thousands, or millions of them. If you manage to break the system by
> writing a function
> with a million clauses then file a bug report. This has often happened
> in the past, often
> a simple fix to the compiler corrects the problem - but we need to
> know about the pathological cases.
So far, I think one of the toughest cases for the compiler is the SQL
grammar, specified in yecc. I don't know exactly how big that is, but
the megaco text parser module consists of some 23,000 lines of code,
mainly in two functions.
More information about the erlang-questions