D14408: SymbolView: Avoid unneeded update of current item
noreply at phabricator.kde.org
Fri Jul 27 07:33:22 BST 2018
sars added a comment.
Hmm... I'm not totally convinced ;)
Stopping the m_currItemTimer when we have an edit is good! We could also avoid starting the timer in cursorPositionChanged() if m_updateTimer is active.
What I'm not convinced about is the increasing of the m_currItemTimer timeout or to cache the first & last lines of the currently active item.
1. The timer is restarted and not triggered as long as the cursor moves. It triggers only when the cursor has stopped for over 100ms. The limit could be just a bit higher than the key-repeat delay and we would just get two newActveItem() invocations. One at the start before the key-repeats have started and one at the end when the key is released.
2. I hope you don't usually have files with more than 1000 "symbols" and even if you would have 1000 symbols the time for looping through those would not be noticeable.
Try adding a QElapsedTimer at the start of updateCurrTreeItem() and check at the end how much time it took. I bet for most files it does not ever go over 1ms (except if there is a kernel-scheduling pause)
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