[knewstuff] Limit request cache size
ClosedPublic

Authored by anthonyfieroni on Dec 13 2017, 9:04 PM.

Details

Summary

Every entry contains images who are memory expensive, so we don't want to store identical entries.

Diff Detail

Repository
R304 KNewStuff
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
anthonyfieroni created this revision.Dec 13 2017, 9:04 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 13 2017, 9:04 PM
anthonyfieroni requested review of this revision.Dec 13 2017, 9:04 PM

Would it simplify things to use a QSet instead?

KNewStuff does not use d pointers so changing QHash<QString, EntryInternal::List> to QHash<QString, QSet<EntryInternal>> will result in binary incomparability, no?

dfaure added a subscriber: dfaure.Dec 14 2017, 2:12 PM

Technically no, since it doesn't change the size of the class itself (and requestCache is private and isn't used in any inline method).

The benefit of QSet over a linear search only starts after a large enough amount of elements in the set though. I have no idea about typical sizes here.

Use QSet instead of QList

Technically no, since it doesn't change the size of the class itself (and requestCache is private and isn't used in any inline method).

You are right, size will not change.

The benefit of QSet over a linear search only starts after a large enough amount of elements in the set though. I have no idea about typical sizes here.

It can be really huge depend of requests intensity.

Well, if this QSet can be huge, then these conversions from QList and to QList are going to take a lot of CPU.
Are you sure it wouldn't be much faster to do a linear search at append time, in exchange for saving all those temporary-containers conversions?
This code looks VERY slow to me, due to the large amount of temporary memory allocations, and linear container conversions.

IMHO the method that returns a List forces us to keep using a List as the data structure.

Well, if this QSet can be huge, then these conversions from QList and to QList are going to take a lot of CPU.
Are you sure it wouldn't be much faster to do a linear search at append time, in exchange for saving all those temporary-containers conversions?

Let's do it linear, for now.

dfaure accepted this revision.Dec 21 2017, 9:03 AM
This revision is now accepted and ready to land.Dec 21 2017, 9:03 AM
This revision was automatically updated to reflect the committed changes.