D11992: Fix bad performance for `addRules` in `DefaultHighlighter` for big containers

Nikita Sirgienko noreply at phabricator.kde.org
Fri Apr 6 19:40:39 UTC 2018


sirgienko created this revision.
sirgienko added reviewers: Cantor, asemke.
sirgienko added a project: Cantor.
Restricted Application added a subscriber: KDE Edu.
Restricted Application added a project: KDE Edu.
sirgienko requested review of this revision.

REVISION SUMMARY
  Now, in `addRules` we call `addRule`, which emit `rulesChanged`, that leads to `rehighlight` all worksheet. This is useless work, because for each rule in rules container we reprocessing all worksheet. (instead better option to emit `rulesChanged` only one time after container processing). So, when container is big, performance falls quite strongly, for example highlighter of octave backend spends 2-4 seconds for adding new function. So this changes improve `emit` logic, calling only one event for rules container.

TEST PLAN
  1. Start octave backend, write octave function, check, that cantor is freezed for few seconds
  2. Apply patch
  3. Check, that octave backend don't freeze after entry with user function.

REPOSITORY
  R55 Cantor

BRANCH
  fix-highlighter-performance-problem

REVISION DETAIL
  https://phabricator.kde.org/D11992

AFFECTED FILES
  src/lib/defaulthighlighter.cpp
  src/lib/defaulthighlighter.h

To: sirgienko, #cantor, asemke
Cc: #cantor, #kde_edu, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20180406/a11064f8/attachment-0001.html>


More information about the kde-edu mailing list