D14408: SymbolView: Avoid unneeded update of current item
noreply at phabricator.kde.org
Fri Jul 27 10:56:17 BST 2018
sars added a comment.
It definitely does **not** mean "The CPU waste does not matter".
I actually tried adding the timer to the function to measure the time. I tried it on a almost 4000 lines long C++ file (far too big ;) and it has around 200 symbols. In the measurements I did, it never reached a full millisecond to finish, it always printed 0ms.
I'm just saying that I don't think the complexity added for the micro-optimization is worth it. It just becomes harder to maintain. The possible gain of **less** than 1ms in the situation when the user presses a key or releases the key, just does not change the perception of how fast or slow the application reacts.
Making the delay longer (200 ms) does not decrease the number of times the function is called. It still stays at once when the key is pressed and once when the key is released.
The bad thing is that the user actually feels that the plugin is slower as it now takes 200ms for the current-item to change in stead of just 100ms previously.
That said I think stopping the m_currItemTimer on document change and not starting it if m_updateTimer is active, is a real noticeable improvement. Especially when adding new lines just above a symbol.
One thing that you could cache without much complexity is the last cursor position and only start the timer if the line changes.
To: loh.tar, #kate, sars
Cc: sars, kwrite-devel, #kate, michaelh, kevinapavew, ngraham, demsking, cullmann, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KWrite-Devel