[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kjs
From:       Maks Orlovich <maksim () kde ! org>
Date:       2007-02-24 20:03:53
Message-ID: 1172347433.496528.15156.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 636952 by orlovich:

Apply suggestion by Batiste Bieler to fix performance 
regression due to Unicode support in regexp code:
disable UTF8 validation in libPCRE, since it's
incredibly slow.

CCMAIL:batiste@dosimple.ch


 M  +4 -3      regexp.cpp  


--- branches/KDE/3.5/kdelibs/kjs/regexp.cpp #636951:636952
@@ -139,7 +139,7 @@
     pcreflags |= PCRE_MULTILINE;
 
   if (utf8Support == Supported)
-    pcreflags |= PCRE_UTF8;
+    pcreflags |= (PCRE_UTF8 | PCRE_NO_UTF8_CHECK);
 
   // Fill our buffer with an encoded version, whether utf-8, or, 
   // if PCRE is incapable, truncated.
@@ -329,8 +329,9 @@
     nextPos  = i + 1;
   }
 
+  int baseFlags = utf8Support == Supported ? PCRE_NO_UTF8_CHECK : 0;
   if (pcre_exec(pcregex, NULL, buffer, bufferSize, startPos,
-                m_notEmpty ? (PCRE_NOTEMPTY | PCRE_ANCHORED) : 0, // see man \
pcretest +                m_notEmpty ? (PCRE_NOTEMPTY | PCRE_ANCHORED | baseFlags) : \
baseFlags, // see man pcretest  ovector ? *ovector : 0L, ovecsize) == \
PCRE_ERROR_NOMATCH)  {
     // Failed to match.
@@ -343,7 +344,7 @@
       fprintf(stderr, "No match after m_notEmpty. +1 and keep going.\n");
 #endif
       m_notEmpty = 0;
-      if (pcre_exec(pcregex, NULL, buffer, bufferSize, nextPos, 0,
+      if (pcre_exec(pcregex, NULL, buffer, bufferSize, nextPos, baseFlags,
                     ovector ? *ovector : 0L, ovecsize) == PCRE_ERROR_NOMATCH)
         return UString::null;
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic