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

Alexander <alex3...@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex3...@mail.ru

--- Comment #8 from Alexander <alex3...@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 watching all bug changes.

Reply via email to