Bug 65659 - make for large projects halts main application UI
Summary: make for large projects halts main application UI
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Output Views (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-07 16:43 UTC by Justin Randall
Modified: 2003-10-18 21:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This patch fixes extremely poor performance (> 20 second hangs) in directory enter/leave parsing when scanning large strings. (5.70 KB, patch)
2003-10-10 13:34 UTC, Justin Randall
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Randall 2003-10-07 16:43:59 UTC
Version:           kdevelop-031003 snapshot (using KDE KDE 3.1.4)
Installed from:    Gentoo Packages
Compiler:          gcc-3.2.3 

When building a large project (with sources that take some time to compile), the entire application slows to a crawl. This is on a dual processor system and make is running with -j 1. Selecting "stop" from the build menu has no effect, the build continues to run.

I didn't build kdevelop with a lot of debugging info, but I attached to it with gdb and saw that it was spending a LOT of time parsing output from the make child process. This doesn't seem to account for the total lack of response in the main application, or the failure of the make widget to accept the signal sent by selecting "stop" from the build menu.

As the build progresses, the responsiveness degrades.
Comment 1 Justin Randall 2003-10-09 23:37:57 UTC
I rebuilt from CVS head as of Oct 9 using -O0 -g3 -pg to start tracking this 
down. A LOT of time is spent (> 20 seconds) in matchEnterDir and matchLeaveDir 
parsing input from the child make process. The offending call in matchEnterDir is 
 
   if (dirChange.search(line) > -1 ) 
 
where dirChange is defined as: 
static QRegExp dirChange(QString::fromLatin1(".*: (.+) (`|") + QChar(0x00BB) + 
QString::fromLatin1(")(.*)('|") + QChar(0x00AB) + QString::fromLatin1(")(.*)")); 
 
and a similar call in matchLeaveDir. The input line is large (631 bytes, lots of 
include directives sent to the compiler). 
 
So, in addition to slowing down the UI, the build is also crippled. My regex-foo 
is pretty weak, so I don't know if this is a problem with the regex or the 
implementation of QRegExp::search.  
 
Comment 2 Justin Randall 2003-10-10 00:26:43 UTC
After further examination of the regex, it would be MUCH better to use a strict 
regex once for each language searching for enter/leave directory. It looks like 
the regex costs nearly O(N!). For input that is several hundred characters in 
length, this is unacceptably slow.  
Comment 3 Justin Randall 2003-10-10 02:40:23 UTC
This is 100% reproducable by adding a ton of -Iblah to INCLUDES in the kdevelop 
project itself. The larger INCLUDES becomes, the worse kdevelop performs. So, the 
more input the "directory change" parser(s) see, the worse kdevelop performs, slowing 
the build and halting any interaction with the UI.  
 
affected code: parts/outputviews/directorystatusmessagefilter.cpp:84 (regex 
declaration in DirectoryStatusMessageFilter::matchEnterDir) 
 
and 
parts/outputviews/directorystatusmessagefulter.cpp:151 (other regex declaration in 
DirectoryStatusMessageFilter::matchLeaveDir) 
 
Comment 4 Justin Randall 2003-10-10 13:34:31 UTC
Created attachment 2729 [details]
This patch fixes extremely poor performance (> 20 second hangs) in directory enter/leave parsing when scanning large strings.

QString finds are first performed against the input line to avoid the very
expensive QRegExp::search. In testing, there was no noticable slowdown compared
to the previous version, and it dramatically improved performance in cases
where the input line was large (always a case that never involved directory
enters/leaves anyway).
Comment 5 Dominik Haumann 2003-10-18 13:07:39 UTC
patch appyed. 'OKed' by adymo.
Is this bug now fixed?
Comment 6 Justin Randall 2003-10-18 17:40:51 UTC
Subject: Re:  make for large projects halts main application UI

On Saturday 18 October 2003 06:07 am, you wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
> You are on the CC list for the bug, or are watching someone who is.
>
> http://bugs.kde.org/show_bug.cgi?id=65659
>
>
>
>
> ------- Additional Comments From dhdev@gmx.de  2003-10-18 13:07 -------
> patch appyed. 'OKed' by adymo.
> Is this bug now fixed?

I'm going to rebuild with the latest CVS (which looks fixed), retry my test case, and if all goes well, close this bug. Thank you for accepting my patch!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/kV64VNfzd40u7PwRAn0kAKCGq7mqb4p50pFyD/aD/YFmFL90xgCeLttV
tnv/MBHOmIAassUnrUXgKSo=
=bg2s
-----END PGP SIGNATURE-----

Comment 7 Justin Randall 2003-10-18 20:15:01 UTC
Subject: Re:  make for large projects halts main application UI

On Saturday 18 October 2003 06:07 am, Dominik Haumann wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
> You are on the CC list for the bug, or are watching someone who is.
>
> http://bugs.kde.org/show_bug.cgi?id=65659
>
>
>
>
> ------- Additional Comments From dhdev@gmx.de  2003-10-18 13:07 -------
> patch appyed. 'OKed' by adymo.
> Is this bug now fixed?

The latest CVS (as of 18 Oct 2003) does not build. I cannot verify this fix. It fails building qextmdi in kdockwidget_compat.h looking for QT headers. I have not changed my build environment. I re-ran the bootstrap procedure, reconfigured, ran make clean, and make.

make[3]: Entering directory `/home/logic/downloads/kdevelop/lib/qextmdi'
g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -O2 -march=athlon-mp -mcpu=athlon-mp -O6 -pipe -mmmx -msse -m3dnow -mfpmath=sse -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DQT_THREAD_SUPPORT  -D_REENTRANT   kdockwidget_compat.moc.cpp   -o kdockwidget_compat.moc
In file included from kdockwidget_compat.moc.cpp:11:
kdockwidget_compat.h:30:20: qpoint.h: No such file or directory
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/kYLWVNfzd40u7PwRAi79AJ9z0rLS+GhlQGV30wIUeUYdJCooXwCfd30E
lfY8ax94ljqREBgLr5dsnkc=
=Svsn
-----END PGP SIGNATURE-----

Comment 8 Alexander Dymo 2003-10-18 21:37:25 UTC
*** Bug has been marked as fixed ***.