[konsole] [Bug 367882] FileFilter implementation cause konsole cpu usage to go to 80-100%

Alexander bugzilla_noreply at kde.org
Thu Dec 1 20:24:52 UTC 2016


https://bugs.kde.org/show_bug.cgi?id=367882

Alexander <alex3255 at mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex3255 at mail.ru

--- Comment #8 from Alexander <alex3255 at mail.ru> ---
Created attachment 102564
  --> https://bugs.kde.org/attachment.cgi?id=102564&action=edit
Program, that illustrates regexp slowness on complex regexps

I found a good test case when FileFilter causes consuming a lot of CPU:
echo
'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////'

And move the mouse inside the window.

The big regular expression is formed from mimeDatabase.allMimeTypes(). If you
have more than 1000 mime types registered (it is 992 in default Kubuntu 16.10
installation) the pcre jit compiler generates very slow code.

I created small python program to illustrate this behaviour.

$ python3 slow_regexp.py
1000 in 0.08 sec
1001 in 4.62 sec

The constant 1000 is rec_limit in pcre_compile.c:
http://vcs.pcre.org/pcre/code/trunk/pcre_compile.c?view=markup

It seems, that other mechanism than mimeDatabase.allMimeTypes() is needed to
create the regexp.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list