-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set current article at most once in loadFinished()
When the current article is set and the user expands or collapses optional parts (e.g. via the Ctrl+* shortcut), ArticleView::setCurrentArticle() is called twice from ArticleView::loadFinished(). Furthermore, the window scroll position is restored before the second jump. This is wasteful. Move the higher-priority setCurrentArticle() call up and, if it succeeds, skip the other call and the scrolling. I have measured the time spent running the affected code fragment on my GNU/Linux system before and at this commit. When the loaded articles are not very large, the performance gain of this commit is only about 1 ms. However, when one of the displayed articles was huge (the "United States" English Wikipedia article), the time went from 120 ms to 5 ms.
- Loading branch information
Showing
2 changed files
with
46 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters