[Qgis-developer] Implementing a cache for the composer attribute table
Matthias Kuhn
matthias.kuhn at gmx.ch
Thu Apr 17 06:10:24 PDT 2014
Hi Nyall,
I'm sorry I can't answer your question why no caching has been done
before, I can just suspect that it was easier to implement and possibly
to prevent memory abuse by heavy caching. From my limited point of view
a +1 for caching.
I just wanted to ask if you considered to use QgsVectorLayerCache
instead of implementing your own caching algorithm. I intentionally
added this class to reduce the number of concurrent caching methods
(there's another one for the vector joins and I think even others). I
think it would be good to switch wherever possible to a single caching
code, so we don't need to maintain several different ones and reinvent
the wheel for e.g. limiting cached features and correct connection of
all involved signals.
Best,
Matthias
On Thu 17 Apr 2014 02:54:14 PM CEST, Nyall Dawson wrote:
> Hi all,
>
> I've just sent a pull request (#1323) which implements a caching
> mechanism for the composer attribute table.
>
> Currently, the composer attribute table is very heavy with the cpu, as
> it refetches the attributes from the layer's provider with every
> paint. This is both expensive and potentially results in many
> duplicated calls to a database backend. This pull request implements
> an attribute cache for the table so that the attributes are only
> refetched when required (item properties change, vector layer emits
> layerModified, or when exporting the composition). The end result is
> that using composer tables no longer results in heavy cpu use and
> continual provider queries.
>
> I'm reluctant to merge this myself as I don't know the history behind
> the composer table, and why it was originally created to requery on
> every paint operation. Perhaps there's a valid reason for this which I
> may be missing? Can anyone shed any light on this and let me know if
> there's a use case I might be overlooking?
>
> Nyall
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list