From 95c71246916f0986101f08ee362429b505cbcd3d Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 18 Aug 2010 04:44:22 +0200 Subject: Add a primitive text machter as an AdBlockRule implementations About 30% of the filter of easylist are just simple text matching. This new AdBlockRule implementation detects the simple occurences of this to match the url directly. On Qt 4.7, this reduce the time spend in AdBlock by around 20%. --- src/adblock/adblockrule.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/adblock/adblockrule.cpp') diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp index 8236f920..1cb6773a 100644 --- a/src/adblock/adblockrule.cpp +++ b/src/adblock/adblockrule.cpp @@ -56,8 +56,12 @@ #include "adblockrule.h" #include "adblockrulefallbackimpl.h" +#include "adblockruletextmatchimpl.h" AdBlockRule::AdBlockRule(const QString &filter) { - m_implementation = QSharedPointer(new AdBlockRuleFallbackImpl(filter)); + if (AdBlockRuleTextMatchImpl::isTextMatchFilter(filter)) + m_implementation = QSharedPointer(new AdBlockRuleTextMatchImpl(filter)); + else + m_implementation = QSharedPointer(new AdBlockRuleFallbackImpl(filter)); } -- cgit v1.2.1