> On Jul 14, 2016, at 12:41 AM, tomr <[email protected]> wrote:
> 
> Hi All,
> 
> Simple perf question, hopefully easy enough to answer that I don't need to 
> spin up a test environment!
> 
> My options are:
> 
> map  http://site.com      http://origin.site.com
> map  http://www.site.com  http://origin.site.com
> 
> vs...
> 
> regex_map http://^(www\.)?site\.com$/  http://origin.site.com
> 
> We have approx 1000 similar rules. Intuitively I would guess that using 2 map 
> rules each time would be a performance win over using a single regex_map 
> rule. Is that likely to be:


Very likely correct. The host lookups are very fast, because of the hash map. 
But if you only have one regex rule like that, the performance impact is likely 
so small that it’s worth having that simpler rule just for ease of use and 
management. The PCRE’s are still pretty fast.

The caveat here is that you have a lot of regexes, you might end up evaluating 
many of them, so the order of the regexes can have a big impact on performance 
(i..e put the one most likely to match first in remap.config).

I believe Bryan and Phil made some performance improvements with PCRE’s, so if 
your platform has a modern PCRE library, it will be able to use the JIT that it 
supports.

Cheers,

— Leif


> - correct?
> - incorrect?
> - "it depends" / not that simple and I really should test it?
> 
> Thanks in advance,
> Tom
> 
> 
> 

Reply via email to