[asterisk-dev] new priority of pattern matching in 1.4. Does it makes sense?

Kevin P. Fleming kpfleming at digium.com
Fri Feb 22 09:18:34 CST 2008


John Lange wrote:

> Shouldn't Asterisk treat all the patterns with equal weight and select
> the best match?

That's contradictory; defining 'best' means patterns have different weights.

Asterisk has always optimized the pattern matching process to avoid
having to search in included contexts and (especially) switch statements
when it can; doing otherwise would mean building a list of all
*possible* patterns for this lookup and then weighing them all, which
could be quite expensive and wasteful if the pattern that ends up
matching is the one in the first context that was searched.

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)



More information about the asterisk-dev mailing list