summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kundrát <jkt@flaska.net>2013-06-17 02:47:43 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-06-18 10:37:22 +0200
commit679fcb31a69194c2d80f0aa0ff9dafeb310b132c (patch)
tree446083437084ab226d7f31d3eae35c165b8d7416
parentFix rekonq pages icons according to last changes in IconManager (diff)
downloadrekonq-679fcb31a69194c2d80f0aa0ff9dafeb310b132c.tar.xz
Speed up construction of the history page
The old version was taking ages to even appear on my setup ("ages" being defined as many minutes at least). Callgrind was crashing, perhaps due to webkit's JIT, so I simply sampled the backtrace "randomly" by hand to see where the most CPU time was being spent. These two methods came up way too often, so I did the following: 1) Do not use KIconLoader within the inner loop, it's slow. It was slow when I debugged too long startup of KPhotoAlbum, it produced visible file IO, and it is trivial to speed this up. However, it was still taking time. 2) Do not request the ".historyitem" over and over again. A cached "pre-found" copy (we're still cloning it) seems to help. Together, these make it possible to load the history in <4 minutes here. It's still a completely insane amount of time, but at least it appears, ultimately. REVIEW:111053
-rw-r--r--src/rekonqpage/newtabpage.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp
index 58451d17..46220514 100644
--- a/src/rekonqpage/newtabpage.cpp
+++ b/src/rekonqpage/newtabpage.cpp
@@ -458,6 +458,8 @@ void NewTabPage::historyPage(const QString & filter)
int i = 0;
const int maxTextSize = 103;
const int truncateSize = 100;
+ const QString removeIconPath = QL1S("file:///") + KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState);
+ QWebElement historyItemElement = markup(QL1S(".historyitem"));
do
{
QModelIndex index = proxy->index(i, 0, QModelIndex());
@@ -473,7 +475,7 @@ void NewTabPage::historyPage(const QString & filter)
QModelIndex son = proxy->index(j, 0, index);
KUrl u = son.data(HistoryModel::UrlStringRole).toUrl();
- historyFolderElement.appendInside(markup(QL1S(".historyitem")));
+ historyFolderElement.appendInside(historyItemElement.clone());
QWebElement item = historyFolderElement.lastChild();
item.findFirst(QL1S(".greytext")).setPlainText( son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm") );
@@ -494,8 +496,7 @@ void NewTabPage::historyPage(const QString & filter)
linkElement.appendInside(shownUrl);
QWebElement removeElement = item.findFirst(QL1S(".button img"));
- removeElement.setAttribute(QL1S("src"), QL1S("file:///") +
- KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState));
+ removeElement.setAttribute(QL1S("src"), removeIconPath);
QWebElement removeLinkElement = item.findFirst(QL1S(".button"));