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

Tzafrir Cohen tzafrir.cohen at xorcom.com
Fri Feb 22 10:40:37 CST 2008


On Fri, Feb 22, 2008 at 09:18:34AM -0600, Kevin P. Fleming wrote:
> 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.

But this optimization is useful only for exact matches, right?
If there's no exact match, you have to search all the included contexts.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-dev mailing list