kdevelop/parts/outputviews

Andras Mantia amantia at freemail.hu
Thu Mar 27 13:17:52 UTC 2003


CVS commit by amantia: 

The output filtering is quite slow. This change will speed up one part of the filtering (when searching for line breaks in the output), and it will speed up quite a well. The time spend to analyze the ouput is reduced by a factor of 2. This makes Gideon usable (but not fast) on my system, but on slower systems it may still take up too much resources. The next problem is in the MakeActionFilter::processLine.
The regexp matching in the for cycle is VERY slow. Enable the debug area for 9004 and watch the output for "SLOW regexp matching". 
Also the other processLine methods in other filters should be reviewed and if it's the case rewritten.

CCMAIL:kdevelop-devel at kdevelop.org


  M +11 -8     commandcontinuationfilter.cpp   1.2
  M +2 -1      compileerrorfilter.cpp   1.2
  M +11 -0     makeactionfilter.cpp   1.5
  M +7 -1      makewidget.cpp   1.65
  M +1 -1      otherfilter.cpp   1.2
  M +3 -1      outputfilter.cpp   1.2


--- kdevelop/parts/outputviews/commandcontinuationfilter.cpp  #1.1:1.2
@@ -20,16 +20,19 @@ CommandContinuationFilter::CommandContin
 void CommandContinuationFilter::processLine( const QString& line )
 {
+  bool foundLineCont = false;
+  QString s = line.stripWhiteSpace();
+  if (s.endsWith("\\"))
+  {
+    m_text += s.left(s.length() - 1);
+    foundLineCont = true;
+  } else
+  {
         m_text += line;
+  }
 
-        QRegExp continuation( "(.*)\\\\\\s*$" );
-
-        if ( continuation.search( m_text ) == -1 )
+        if ( !foundLineCont )
         {
                 OutputFilter::processLine( m_text );
                 m_text = "";
-        }
-        else
-        {
-                m_text = continuation.cap(1);
         }
 }

--- kdevelop/parts/outputviews/makeactionfilter.cpp  #1.4:1.5
@@ -10,4 +10,7 @@
  ***************************************************************************/
 
+#include <qdatetime.h>
+#include <kdebug.h>
+
 #include "makeactionfilter.h"
 #include "makeactionfilter.moc"
@@ -48,8 +51,13 @@ const QValueList<MakeActionFilter::Actio
 void MakeActionFilter::processLine( const QString& line )
 {
+  QTime t;
+  t.start();
+
         bool hasmatch = false;
         QString act;
         QString file;
         QString tool;
+  //FIXME: This is very slow, possibly due to the regexr matching. It can take
+  //900-1000ms to execute on an Athlon XP 2000+, while the UI is completely blocked.
         QValueList<ActionFormat>::const_iterator it = actionFormats().begin();
         for( ; it != actionFormats().end(); ++it )
@@ -64,4 +72,6 @@ void MakeActionFilter::processLine( cons
                 break;
         }
+  if (t.elapsed() > 100)
+    kdDebug(9004) << "MakeActionFilter::processLine: SLOW regexp matching: " << t.elapsed() << " ms \n";
 
         if ( hasmatch )

--- kdevelop/parts/outputviews/makewidget.cpp  #1.64:1.65
@@ -489,5 +493,5 @@ void MakeWidget::insertItem( MakeItem* i
                 return;
 
-        SelectionPreserver preserveSelection( *this, !m_vertScrolling && !m_horizScrolling );
+        //SelectionPreserver preserveSelection( *this, !m_vertScrolling && !m_horizScrolling );
 
         m_paragraphToItem.insert( m_paragraphs++, item );

--- kdevelop/parts/outputviews/outputfilter.cpp  #1.1:1.2
@@ -11,4 +11,6 @@
 
 #include "outputfilter.h"
+#include <qdatetime.h>
+#include <kdebug.h>
 
 OutputFilter::OutputFilter( OutputFilter& next )






More information about the KDevelop-devel mailing list