From 9ce73e2e1e2e676030d17c905b5b283bba985338 Mon Sep 17 00:00:00 2001 From: Stef T Date: Wed, 26 Sep 2012 23:38:18 +0200 Subject: [PATCH] vastly improvee the speed of the access_processor's main process method by returning dict's instead of lists from IPTools. This turns a very nasty O(n)*3 into O(1)*3 .. much nicer. All tests pass. --- slogging/access_processor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/slogging/access_processor.py b/slogging/access_processor.py index 0127f15..f11336d 100644 --- a/slogging/access_processor.py +++ b/slogging/access_processor.py @@ -24,8 +24,9 @@ try: CIDR_support = True def return_ips(conf, conf_tag): - return IpRangeList(*[x.strip() for x in - conf.get(conf_tag, '').split(',') if x.strip()]) + return dict((k, 1) for k in + IpRangeList(*[x.strip() for x in + conf.get(conf_tag, '').split(',') if x.strip()])) def sanitize_ips(line_data): for x in ['lb_ip', 'client_ip', 'log_source']: if line_data[x] == '-':