From ad7ad8f596de9e9cb3877eb7a74c3b436d23205e Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sat, 25 Jul 2015 01:17:17 +0300 Subject: [PATCH] Faster GeoIP lookups. QCache results in speed decrease. See https://github.com/qbittorrent/qBittorrent/pull/3488#issuecomment-124731983 --- src/core/net/geoipmanager.cpp | 12 ++---------- src/core/net/geoipmanager.h | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/core/net/geoipmanager.cpp b/src/core/net/geoipmanager.cpp index f5988bbad..d54888798 100644 --- a/src/core/net/geoipmanager.cpp +++ b/src/core/net/geoipmanager.cpp @@ -57,7 +57,6 @@ GeoIPManager *GeoIPManager::m_instance = 0; GeoIPManager::GeoIPManager() : m_enabled(false) , m_geoIPDatabase(0) - , m_cache(CACHE_SIZE) { configure(); connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure())); @@ -126,15 +125,8 @@ void GeoIPManager::downloadDatabaseFile() QString GeoIPManager::lookup(const QHostAddress &hostAddr) const { - if (m_enabled && m_geoIPDatabase) { - QString *country = m_cache.object(hostAddr); - if (country) - return *country; - - QString code = m_geoIPDatabase->lookup(hostAddr); - m_cache.insert(hostAddr, new QString(code)); - return code; - } + if (m_enabled && m_geoIPDatabase) + return m_geoIPDatabase->lookup(hostAddr); return QString(); } diff --git a/src/core/net/geoipmanager.h b/src/core/net/geoipmanager.h index d400bd849..ddfb7d25a 100644 --- a/src/core/net/geoipmanager.h +++ b/src/core/net/geoipmanager.h @@ -68,7 +68,6 @@ namespace Net bool m_enabled; GeoIPDatabase *m_geoIPDatabase; - mutable QCache m_cache; static GeoIPManager *m_instance; };