[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: Review Request 114460: Remove even more redundant data from KItemListViewLayouter
From: "Emmanuel Pescosta" <emmanuelpescosta099 () gmail ! com>
Date: 2013-12-22 14:32:49
Message-ID: 20131222143249.4580.2387 () probe ! kde ! org
[Download RAW message or body]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/114460/#review46043
-----------------------------------------------------------
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32840>
m_itemInfos[index] -> m_itemInfos.at(index)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32841>
m_itemInfos[index] -> m_itemInfos.at(index)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32842>
m_itemInfos[index] -> m_itemInfos.at(index)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32843>
m_itemInfos[index] -> m_itemInfos.at(index)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32844>
m_itemInfos[mid] -> m_itemInfos.at(mid)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32845>
m_itemInfos[mid] -> m_itemInfos.at(mid)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32846>
m_itemInfos[mid] -> m_itemInfos.at(mid)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32847>
m_itemInfos[mid] -> m_itemInfos.at(mid)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32848>
m_itemInfos[mid - 1] -> m_itemInfos.at(mid - 1)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32849>
m_itemInfos[mid] -> m_itemInfos.at(mid)
dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp
<https://git.reviewboard.kde.org/r/114460/#comment32850>
m_itemInfos[mid] -> m_itemInfos.at(mid)
- Emmanuel Pescosta
On Dec. 14, 2013, 7:37 p.m., Frank Reininghaus wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/114460/
> -----------------------------------------------------------
>
> (Updated Dec. 14, 2013, 7:37 p.m.)
>
>
> Review request for Dolphin.
>
>
> Repository: kde-baseapps
>
>
> Description
> -------
>
> After https://git.reviewboard.kde.org/r/113487/, KItemListViewLayouter still stores \
> quite a bit of redundant data.
> For every item, we store the coordinates of its top-left corner in a QPointF 'pos' \
> in the ItemInfo struct. This requires
> 2 * "number of items" doubles.
>
> However, pos.x is the same for all items in one column, and pos.y is the same for \
> all items in a row. Therefore, some memory can be saved by removing the 'pos' \
> member, and adding two QVector<qreal>
> m_rowOffsets and m_columnOffsets
>
> instead. This reduces the memory requirement to
>
> "number of rows + number of columns" doubles, which is at least 50% less.
>
>
> Diffs
> -----
>
> dolphin/src/kitemviews/private/kitemlistviewlayouter.h a3b0893
> dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp f5f63d5
>
> Diff: https://git.reviewboard.kde.org/r/114460/diff/
>
>
> Testing
> -------
>
> Verfified with KSysGuard that the memory consumption is reduced as expected. View \
> layout and scrolling still seem to work OK in all view modes and with grouping \
> enabled or disabled.
>
> Thanks,
>
> Frank Reininghaus
>
>
[Attachment #3 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/114460/">https://git.reviewboard.kde.org/r/114460/</a>
</td>
</tr>
</table>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line251" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QRectF \
KItemListViewLayouter::itemRect(int index) const</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">251</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">const</span> <span class="n">qreal</span> <span class="n">x</span> <span \
class="o">=</span> <span class="n">m_columnOffsets</span><span \
class="p">.</span><span class="n">at</span><span class="p">(</span><span \
class="n">m_itemInfos</span><span class="p">[</span><span class="n">index</span><span \
class="p">].</span><span class="n">column</span><span class="p">);</span></pre></td> \
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[index] -> m_itemInfos.at(index)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line252" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QRectF \
KItemListViewLayouter::itemRect(int index) const</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">252</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">const</span> <span class="n">qreal</span> <span class="n">y</span> <span \
class="o">=</span> <span class="n">m_rowOffsets</span><span class="p">.</span><span \
class="n">at</span><span class="p">(</span><span class="n">m_itemInfos</span><span \
class="p">[</span><span class="n">index</span><span class="p">].</span><span \
class="n">row</span><span class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[index] -> m_itemInfos.at(index)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line297" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QRectF \
KItemListViewLayouter::groupHeaderRect(int index) const</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">292</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">const</span> <span class="n"><span class="hl">qreal</span></span><span \
class="hl"> </span><span class="n"><span class="hl">y</span></span> <span \
class="o">=</span> <span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">index</span><span class="p">].</span><span class="n"><span \
class="hl">pos</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">y</span></span><span class="p"><span \
class="hl">()</span>;</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: \
1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">295</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">const</span> <span \
class="kt"><span class="hl">int</span></span><span class="hl"> </span><span \
class="n"><span class="hl">row</span></span> <span class="o">=</span> <span \
class="n">m_itemInfos</span><span class="p">[</span><span class="n">index</span><span \
class="p">].</span><span class="n"><span class="hl">row</span></span><span \
class="p">;</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[index] -> m_itemInfos.at(index)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line300" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QRectF \
KItemListViewLayouter::groupHeaderRect(int index) const</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">295</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k"><span class="hl">const</span></span><span class="hl"> </span><span \
class="n"><span class="hl">QPointF</span></span><span class="hl"> </span><span \
class="n"><span class="hl">pos</span></span><span class="hl"> </span><span \
class="o"><span class="hl">=</span></span><span class="hl"> </span><span \
class="n">m_itemInfos</span><span class="p">[</span><span class="n">index</span><span \
class="p">].</span><span class="n"><span class="hl">pos</span></span><span \
class="p"><span class="hl">;</span></span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">298</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k"><span class="hl">if</span></span><span class="hl"> </span><span \
class="p"><span class="hl">(</span></span><span class="n">m_itemInfos</span><span \
class="p">[</span><span class="n">index</span><span class="p">].</span><span \
class="n"><span class="hl">row</span></span><span class="hl"> </span><span \
class="o"><span class="hl">!=</span></span><span class="hl"> </span><span \
class="n"><span class="hl">row</span></span><span class="p"><span \
class="hl">)</span></span><span class="hl"> </span><span class="p"><span \
class="hl">{</span></span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[index] -> m_itemInfos.at(index)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line583" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">550</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="n">m_itemInfos</span><span \
class="p">[</span><span class="n">mid</span><span class="p">].</span><span \
class="n"><span class="hl">pos</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">y</span></span><span \
class="p"><span class="hl">(</span>)</span> <span class="o"><</span> <span \
class="n">m_scrollOffset</span><span class="p">)</span> <span \
class="p">{</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">571</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">if</span> <span \
class="p"><span class="hl">(</span></span><span class="n"><span \
class="hl">m_rowOffsets</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">at</span></span><span \
class="p">(</span><span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">row</span></span><span class="p">)</span> <span class="o"><</span> \
<span class="n">m_scrollOffset</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid] -> m_itemInfos.at(mid)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line593" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">560</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="n">m_itemInfos</span><span \
class="p">[</span><span class="n">mid</span><span class="p">].</span><span \
class="n"><span class="hl">pos</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">y</span></span><span \
class="p"><span class="hl">(</span>)</span> <span class="o">>=</span> <span \
class="n">m_scrollOffset</span><span class="p">)</span> <span \
class="p">{</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">581</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">if</span> <span \
class="p"><span class="hl">(</span></span><span class="n"><span \
class="hl">m_rowOffsets</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">at</span></span><span \
class="p">(</span><span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">row</span></span><span class="p">)</span> <span class="o">>=</span> \
<span class="n">m_scrollOffset</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid] -> m_itemInfos.at(mid)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line595" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">562</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">Q_ASSERT</span><span class="p">(</span><span \
class="n">m_itemInfos</span><span class="p">[</span><span class="n">mid</span><span \
class="p">].</span><span class="n"><span class="hl">pos</span></span><span \
class="p"><span class="hl">.</span></span><span class="n"><span \
class="hl">y</span></span><span class="p"><span class="hl">(</span>)</span> <span \
class="o"><</span> <span class="n">m_scrollOffset</span><span \
class="p">);</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">583</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">Q_ASSERT</span><span \
class="p">(</span><span class="n">m_<span class="hl">rowOffsets</span></span><span \
class="p"><span class="hl">.</span></span><span class="n"><span \
class="hl">at</span></span><span class="p"><span class="hl">(</span></span><span \
class="n"><span class="hl">m_</span>itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">row</span></span><span class="p">)</span> <span class="o"><</span> \
<span class="n">m_scrollOffset</span><span class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid] -> m_itemInfos.at(mid)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line598" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">565</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">const</span> <span class="n"><span class="hl">qreal</span></span><span \
class="hl"> </span><span class="n"><span class="hl">rowTop</span></span> <span \
class="o">=</span> <span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">pos</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">y</span></span><span class="p"><span \
class="hl">()</span>;</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: \
1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">586</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">const</span> <span \
class="kt"><span class="hl">int</span></span><span class="hl"> </span><span \
class="n"><span class="hl">firstVisibleRow</span></span> <span class="o">=</span> \
<span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">row</span></span><span class="p">;</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid] -> m_itemInfos.at(mid)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line599" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">566</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">while</span> <span class="p">(</span><span class="n">mid</span> <span \
class="o">></span> <span class="mi">0</span> <span class="o">&&</span> \
<span class="n">m_itemInfos</span><span class="p">[</span><span class="n">mid</span> \
<span class="o">-</span> <span class="mi">1</span><span class="p">].</span><span \
class="n"><span class="hl">pos</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">y</span></span><span \
class="p"><span class="hl">()</span></span> <span class="o">==</span> <span \
class="n"><span class="hl">rowTop</span></span><span class="p">)</span> <span \
class="p">{</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">587</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">while</span> <span \
class="p">(</span><span class="n">mid</span> <span class="o">></span> <span \
class="mi">0</span> <span class="o">&&</span> <span \
class="n">m_itemInfos</span><span class="p">[</span><span class="n">mid</span> <span \
class="o">-</span> <span class="mi">1</span><span class="p">].</span><span \
class="n"><span class="hl">row</span></span> <span class="o">==</span> <span \
class="n"><span class="hl">firstVisibleRow</span></span><span class="p">)</span> \
<span class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid - 1] -> m_itemInfos.at(mid - 1)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line616" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">583</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="n">m_itemInfos</span><span \
class="p">[</span><span class="n">mid</span><span class="p">].</span><span \
class="n"><span class="hl">pos</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">y</span></span><span \
class="p"><span class="hl">(</span>)</span> <span class="o"><=</span> <span \
class="n">bottom</span><span class="p">)</span> <span class="p">{</span></pre></td> \
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">604</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p"><span class="hl">(</span></span><span \
class="n"><span class="hl">m_rowOffsets</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">at</span></span><span \
class="p">(</span><span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">row</span></span><span class="p">)</span> <span class="o"><=</span> \
<span class="n">bottom</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid] -> m_itemInfos.at(mid)</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/114460/diff/1/?file=224915#file224915line623" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KItemListViewLayouter::updateVisibleIndexes()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">590</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">while</span> <span class="p">(</span><span class="n">mid</span> <span \
class="o">></span> <span class="mi">0</span> <span class="o">&&</span> \
<span class="n">m_itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">pos</span></span><span class="p"><span class="hl">.</span></span><span \
class="n"><span class="hl">y</span></span><span class="p"><span \
class="hl">(</span>)</span> <span class="o">></span> <span \
class="n">bottom</span><span class="p">)</span> <span class="p">{</span></pre></td> \
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">611</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">while</span> <span class="p">(</span><span class="n">mid</span> <span \
class="o">></span> <span class="mi">0</span> <span class="o">&&</span> \
<span class="n">m_<span class="hl">rowOffsets</span></span><span class="p"><span \
class="hl">.</span></span><span class="n"><span class="hl">at</span></span><span \
class="p"><span class="hl">(</span></span><span class="n"><span \
class="hl">m_</span>itemInfos</span><span class="p">[</span><span \
class="n">mid</span><span class="p">].</span><span class="n"><span \
class="hl">row</span></span><span class="p">)</span> <span class="o">></span> \
<span class="n">bottom</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_itemInfos[mid] -> m_itemInfos.at(mid)</pre> </div>
<br />
<p>- Emmanuel Pescosta</p>
<br />
<p>On December 14th, 2013, 7:37 p.m. CET, Frank Reininghaus wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Dolphin.</div>
<div>By Frank Reininghaus.</div>
<p style="color: grey;"><i>Updated Dec. 14, 2013, 7:37 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kde-baseapps
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">After https://git.reviewboard.kde.org/r/113487/, KItemListViewLayouter \
still stores quite a bit of redundant data.
For every item, we store the coordinates of its top-left corner in a QPointF \
'pos' in the ItemInfo struct. This requires
2 * "number of items" doubles.
However, pos.x is the same for all items in one column, and pos.y is the same for all \
items in a row. Therefore, some memory can be saved by removing the 'pos' \
member, and adding two QVector<qreal>
m_rowOffsets and m_columnOffsets
instead. This reduces the memory requirement to
"number of rows + number of columns" doubles, which is at least 50% \
less.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Verfified with KSysGuard that the memory consumption is reduced as \
expected. View layout and scrolling still seem to work OK in all view modes and with \
grouping enabled or disabled.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>dolphin/src/kitemviews/private/kitemlistviewlayouter.h <span style="color: \
grey">(a3b0893)</span></li>
<li>dolphin/src/kitemviews/private/kitemlistviewlayouter.cpp <span style="color: \
grey">(f5f63d5)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/114460/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic