Several performance optimisations for Akregator
ClosedPublic

Authored by pinaraf on Apr 23 2018, 9:40 PM.

Details

Summary
  1. Fetch title, pubdate, hash and status in a single storage call

Even with MK4, the performance gain is sensible.
For medium sized archives (~25k articles), it's feeling faster.
For huge archives (>100k articles), it is human measurably faster.

  1. Reuse the FeedStorage instead of fetching it for each article

For huge archives, this helps performance a bit

  1. Drop useless call to isNull in model

All calls are safe even when the article is null.
And their results will be similar to QVariant().
This call is thus useless, and one of the biggest 'perf' offender

Diff Detail

Repository
R201 Akregator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
pinaraf created this revision.Apr 23 2018, 9:40 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 23 2018, 9:40 PM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
pinaraf requested review of this revision.Apr 23 2018, 9:40 PM
pinaraf updated this revision to Diff 32926.Apr 23 2018, 10:20 PM
  • Make sure all articles are not fetched uselessly at start/end

With all these changes, akregator starts up almost instantly on my computer. RAM usage is far lower at startup (but sadly still grows once feeds are fetched, there are still ways for improvement here).
Also I suspect the guid 'cache' was a quite nice long term leak in akregator. I have no idea since how long that leak existed…

pinaraf updated this revision to Diff 32948.Apr 24 2018, 6:58 AM
  • Use the new FeedStorage::article() call
dvratil added inline comments.
src/dummystorage/feedstoragedummyimpl.cpp
215

Since we are talking performance here, I'd suggest using

const auto it = d->entries.constFind(guid);
if (it != d->entries.cend()) {
    ....
}

This way you avoid looking up the the entry in the hashtable twice (once in contains() and once in operator[]).

src/feed/feed.cpp
403–405

This change does not seem related, could you explain it a bit more?

pinaraf marked an inline comment as done.Apr 24 2018, 10:27 AM
pinaraf added inline comments.
src/dummystorage/feedstoragedummyimpl.cpp
215

Indeed, but note that this is the dummy feed storage, that is almost unused (it is used if you disable archiving, or if the other backends fail to load)

src/feed/feed.cpp
403–405

Sadly it is. The markImmediatelyAsRead flag is described in the user interface as «marking feeds as read when new articles arrive».
The current implementation does that, but also marks every article as read at startup.
This does not map to the current user interface description, and implies reading every article for such feeds, seriously impacting startup time.

mlaurent added inline comments.Apr 24 2018, 11:56 AM
interfaces/article.h
75

Perhaps you can merge this two constructors no ?

plugins/mk4storage/feedstoragemk4impl.h
47

coding style. Remove space after &

pinaraf updated this revision to Diff 33014.Apr 24 2018, 8:33 PM
pinaraf marked 3 inline comments as done.
  • Fixes following review
interfaces/article.h
75

Done

plugins/mk4storage/feedstoragemk4impl.h
47

Done

Looks good to me. @mlaurent ?

mlaurent accepted this revision.May 2 2018, 6:01 AM

Seems ok for me too.

This revision is now accepted and ready to land.May 2 2018, 6:01 AM
This revision was automatically updated to reflect the committed changes.