diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-08-18 23:41:05 +0200 |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-08-19 03:18:29 +0200 |
commit | e5815346cd4870640051856abed0887717aa0bf7 (patch) | |
tree | 7ff7d8a66d1febfcc793dbe67c9d3d182ab05977 /src/adblock/adblockrule.h | |
parent | Merge commit 'refs/merge-requests/178' of git://gitorious.org/rekonq/mainline... (diff) | |
download | rekonq-e5815346cd4870640051856abed0887717aa0bf7.tar.xz |
Improve the performance of AdBlockRuleTextMatchImpl
Comparing unicode string without case sensitive is rather expensive
because each codepoint must be converted, which is non trivial for
unicode.
This patch introduce a new argument of ::match() taking the encoded
url in lowercase. This way, the conversion can be done only once
for a lot of rules.
Diffstat (limited to 'src/adblock/adblockrule.h')
-rw-r--r-- | src/adblock/adblockrule.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h index 04409688..ef7b2f5f 100644 --- a/src/adblock/adblockrule.h +++ b/src/adblock/adblockrule.h @@ -70,9 +70,10 @@ class AdBlockRule public: AdBlockRule(const QString &filter); - bool match(const QString &encodedUrl) const + bool match(const QString &encodedUrl, const QString &encodedUrlLowerCase) const { - return m_implementation->match(encodedUrl); + Q_ASSERT(encodedUrl.toLower() == encodedUrlLowerCase); + return m_implementation->match(encodedUrl, encodedUrlLowerCase); } private: |