<table><tr><td style="">jtamate updated this revision to Diff 29975.<br />jtamate retitled this revision from "simple optimization of TextLineData::attribute" to "optimization of TextLineData::attribute".<br />jtamate edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-ds5zuisegve3bmd/">(Show Details)</a><br />jtamate edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-smx3ocvp7xxdfgz/">(Show Details)</a><br />jtamate added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D11487">View Revision</a></tr></table><br /><div><div><p>As m_attributesList is sorted, otherwise the original implementation will not work, <br />
do a binary search looking for the lowest item that has offset >= pos.</p>

<p>It gets even better, 0,32% of cpu in callgrind.</p></div></div><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Instead of getting the element to check 4 to 5 times each time, using</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Use a binary search for</span> the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">range-based for, do it only once</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">needed Attribute</span>.<br />
<br />
>From 76,84% of cpu {F5758695}<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">to 19.1</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">to 0.3</span>2% of cpu<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> {F5758696}</span><br />
<br />
in callgrind.<br />
</div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;">Open a XML file with 4 lines and a line of 566039 characters long.<br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Accept to reopen the file, move to the end of the file (ctrl+end), and close.</span></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D11487?vs=29925&id=29975">https://phabricator.kde.org/D11487?vs=29925&id=29975</a></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D11487">https://phabricator.kde.org/D11487</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/buffer/katetextline.h</div></div></div><br /><div><strong>To: </strong>jtamate, Frameworks, Kate<br /><strong>Cc: </strong>cullmann, michaelh, kevinapavew, ngraham, demsking, sars, dhaumann<br /></div>