[squid-users] Regex optimization

Yuri Voinov yvoinov at gmail.com
Wed Apr 27 13:28:07 UTC 2016


When you test regex, you can see this:




and this:


As you can see, green bar in upper right corner shows you steps count when
parse and _execute_ regex.

This is performance info you required. This is obvious.

More steps - slower exec. So odd you can't see obvious.
Otherwise only regex gurus/creator can tell you how fast/slow is any regex.
Regex is magic.

Also, just for minute, you asking in wrong place. This is squid, not regex.

Best rgrds, Yuri

2016-04-27 19:11 GMT+06:00 Alfredo Rezinovsky <alfrenovsky at gmail.com>:

> Not my question. I'm asking about performance
> 2016-04-27 9:09 GMT-03:00 Yuri Voinov <yvoinov at gmail.com>:
>> https://regex101.com is your best friend.
>> 27.04.16 17:32, Alfredo Rezinovsky пишет:
>> I saw in debug log that when an ACL has many regexes each one is compared
>> sequentially.
>> If I have
>> www.facebook.com
>> facebook.com
>> www.google.com
>> google.com
>> If will be faster to check just ONE optimized regex like
>> (www\.)?(facebook|google).com than the previous three?
>> I'm really talking about optimizing about 3000 url regexes in one huge
>> regex because comparing each and every url to 3000 regexes is too slow.
>> I know using
>> (www\.facebook\.com)|(facebook\.com)|(www\.google\.com)|(google\.com) with
>> PCRE will produce the same optimized result as
>> (www\.)?(facebook|google)\.com. Squid uses GnuRegex. Does GNURegex lib
>> optimizes this as well ?
> --
> Alfrenovsky

-= WBR, Yuri.
                    Powered by Google =-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20160427/d55330a9/attachment.html>

More information about the squid-users mailing list