1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Improved performance of WebHistoryInterface

Use std::set to search in logarithmic time.
This commit is contained in:
nowrep 2013-06-09 12:05:20 +02:00
parent 8e9ea139db
commit acbd04dd3d
2 changed files with 4 additions and 4 deletions

View File

@ -26,10 +26,10 @@ WebHistoryInterface::WebHistoryInterface(QObject* parent)
void WebHistoryInterface::addHistoryEntry(const QString &url) void WebHistoryInterface::addHistoryEntry(const QString &url)
{ {
m_clickedLinks.append(url); m_clickedLinks.insert(url);
} }
bool WebHistoryInterface::historyContains(const QString &url) const bool WebHistoryInterface::historyContains(const QString &url) const
{ {
return m_clickedLinks.contains(url); return m_clickedLinks.find(url) != m_clickedLinks.end();
} }

View File

@ -19,7 +19,7 @@
#define WEBHISTORYINTERFACE_H #define WEBHISTORYINTERFACE_H
#include <QWebHistoryInterface> #include <QWebHistoryInterface>
#include <QStringList> #include <set>
#include "qz_namespace.h" #include "qz_namespace.h"
@ -32,7 +32,7 @@ public:
bool historyContains(const QString &url) const; bool historyContains(const QString &url) const;
private: private:
QStringList m_clickedLinks; std::set<QString> m_clickedLinks;
}; };