<table><tr><td style="">jtamate updated this revision to Diff 30117.<br />jtamate edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-6zfbanb6qy4pp2h/">(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>The problem with attribute() is that with a long line and word wrapping enabled,<br />
when the long line is shown, it is called  as many times as the length of the line,<br />
in my test case, 566.039 times.</p>

<p>The list is not always so small...In my test file, the longest list has 7257 items.<br />
Therefore, previously it had to go trough, in average,  3628 items 566.039 times.</p>

<p>Kate and Okteta are the only tools that can handle such files and be responsive to user input.</p></div></div><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;">Use a<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> custom</span> binary search for the needed Attribute<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">.<br />
Also moved the implementation from the header</span>.<br />
<br />
>From 76,84% of cpu {F5758695}<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
<br />
to 0.08% of cpu {F5761241}</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">to 0.32% of cpu</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">in callgrind doing the following:</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">in callgrind</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Open an XML file with 4 lines and a line of 566039 characters long</span>.<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.<br />
<br />
The time difference can also be noticed in the autotests.</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=29975&id=30117">https://phabricator.kde.org/D11487?vs=29975&id=30117</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.cpp<br />
src/buffer/katetextline.h</div></div></div><br /><div><strong>To: </strong>jtamate, Frameworks, Kate<br /><strong>Cc: </strong>mwolff, cullmann, michaelh, kevinapavew, ngraham, demsking, sars, dhaumann<br /></div>