Re: [squid-users] Complicate ACL affect performance?

From: Henrik K <hege_at_hege.li>
Date: Sat, 18 Oct 2008 14:26:46 +0300

On Sat, Oct 18, 2008 at 11:54:52PM +1300, Amos Jeffries wrote:
> Henrik K wrote:
>> On Sat, Oct 18, 2008 at 12:44:46PM +0300, Henrik K wrote:
>>> Not sure what the splay code does in Squid, didn't have time to grab it.
>>> But a simple test with Perl:
>>>
>>> - Grepped some hostnames from wwwlogs etc
>>> - Regexp::Assemble'd 50000 unique hostnames (= 560kB regex, took 22 sec)
>>> - Run 100000 hostnames on it in 4 seconds (25000 hosts/sec on 2.8Ghz CPU)
>>>
>>> It's pretty powerful stuff.
>>
>> Oops, did it even slightly wrong.
>>
>> By doing it correctly, using ^hostname$ instead of plain hostname in regex
>> results in 1.2 seconds, that's 80000+ hosts/sec..
>>
>
> Sill out slightly. The fair test for that vs squid splay tree would be
> still missing the ^ to match any given *.example.com$

Fair test would be reversing the hostname, which is very cheap operation. ;)

(^|\.)example\.com$ .. runtime 2.2 secs
^moc\.elpmaxe(\.|$) .. runtime 1.3 secs

No one is suggesting that dstdomain should be replaced by regexs though.
This just proves that if you need them, they can be used efficiently.
Received on Sat Oct 18 2008 - 11:26:52 MDT

This archive was generated by hypermail 2.2.0 : Sun Oct 19 2008 - 12:00:04 MDT