Review Request 111304: Replace QList by QVector in two places to reduce memory usage

Frank Reininghaus frank78ac at googlemail.com
Fri Jun 28 21:05:52 BST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111304/
-----------------------------------------------------------

Review request for Dolphin.


Description
-------

Just the other day I noticed that we use QList in two places where the stored data type is larger than a pointer. In that case, QList stores not the items themselves in a contiguous memory block, but pointers to these items [1, 2]. This means that we have two unneeded pointers for every item, i.e., 16 bytes per item on a 64-bit system.

This can be changed in a rather straightforward way by replacing QList by QVector in these cases.

[1] http://marcmutz.wordpress.com/effective-qt/containers/
[2] http://doc.qt.digia.com/qq/qq19-containers.html


Diffs
-----

  dolphin/src/kitemviews/private/kitemlistsizehintresolver.h 1345e03 
  dolphin/src/kitemviews/private/kitemlistsizehintresolver.cpp c76ff0f 
  dolphin/src/kitemviews/private/kitemlistviewlayouter.h 5ca73e1 

Diff: http://git.reviewboard.kde.org/r/111304/diff/


Testing
-------

KSysguard confirms that we need a few megabytes less when loading folders with many items.


Thanks,

Frank Reininghaus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20130628/a93a70f9/attachment.htm>


More information about the kfm-devel mailing list