Bug 376504 - Switching to Vi input mode causes a CPU usage spike
Summary: Switching to Vi input mode causes a CPU usage spike
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (show other bugs)
Version: 16.08
Platform: Microsoft Windows Microsoft Windows
: NOR major
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-15 06:06 UTC by V C
Modified: 2017-08-10 05:05 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description V C 2017-02-15 06:06:34 UTC
On Windows, with v16.08.3, switching to 'Vi' input mode and performing some Vi operation (in the command mode, say, :25,$s/^/#) causes a CPU spike (on my system to over 23%) and stays up. This does not come down even when I switch back to 'Normal' input mode.
Comment 1 Dominik Haumann 2017-02-18 11:52:57 UTC
@vi mode developers: maybe you can have a look?
Comment 2 Martin Sandsmark 2017-07-01 11:44:19 UTC
seems like a busyloop in emulatedcommandbar, according to `perf top` and gdb.

what is this code supposed to do, why is it looping?:

https://github.com/KDE/ktexteditor/blob/master/src/vimode/emulatedcommandbar/emulatedcommandbar.cpp#L135-L137

::hasPendingEvents() is obsolete, so it has probably changed to just return true all the time or something.
Comment 3 Martin Sandsmark 2017-07-01 11:51:07 UTC
https://git.reviewboard.kde.org/r/130168/
Comment 4 Martin Sandsmark 2017-07-01 16:38:16 UTC
Git commit 86f75f4f384ad9e0308c817dc4e3cbda176c2f9b by Martin T. H. Sandsmark.
Committed on 01/07/2017 at 16:37.
Pushed by sandsmark into branch 'master'.

Fix cpu usage spiking after showing vi command bar

With Qt 5.9 (at least), QCoreApplication::hasPendingEvents() (which is
already marked as obsolete) seems to unconditionally return true, at
least here. The looping didn't make sense at all anyways.

REVIEW: 130168

M  +1    -3    src/vimode/emulatedcommandbar/emulatedcommandbar.cpp

https://commits.kde.org/ktexteditor/86f75f4f384ad9e0308c817dc4e3cbda176c2f9b
Comment 5 V C 2017-08-10 05:05:44 UTC
Thanks Martin!

Any idea when the next release might be with this fix?

Best regards!