[Pcre-svn] [1345] code/trunk: Small performance improvement …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1345] code/trunk: Small performance improvement in strlen16 and strlen32 in pcretest.
Revision: 1345
          http://vcs.pcre.org/viewvc?view=rev&revision=1345
Author:   ph10
Date:     2013-07-02 18:52:28 +0100 (Tue, 02 Jul 2013)


Log Message:
-----------
Small performance improvement in strlen16 and strlen32 in pcretest.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcretest.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2013-07-02 17:40:20 UTC (rev 1344)
+++ code/trunk/ChangeLog    2013-07-02 17:52:28 UTC (rev 1345)
@@ -14,6 +14,9 @@
     enable coverage support, which is totally false. There was also support for
     setting this macro in the CMake files (my fault, I just copied it from
     configure). SUPPORT_GCOV has now been removed.
+    
+3.  Make a small performance improvement in strlen16() and strlen32() in
+    pcretest.



Version 8.33 28-May-2013

Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2013-07-02 17:40:20 UTC (rev 1344)
+++ code/trunk/pcretest.c    2013-07-02 17:52:28 UTC (rev 1345)
@@ -2031,9 +2031,9 @@


static int strlen16(PCRE_SPTR16 p)
{
-int len = 0;
-while (*p++ != 0) len++;
-return len;
+PCRE_SPTR16 pp = p;
+while (*pp != 0) pp++;
+return (int)(pp - p);
}
#endif /* SUPPORT_PCRE16 */

@@ -2046,9 +2046,9 @@

static int strlen32(PCRE_SPTR32 p)
{
-int len = 0;
-while (*p++ != 0) len++;
-return len;
+PCRE_SPTR32 pp = p;
+while (*pp != 0) pp++;
+return (int)(pp - p);
}
#endif /* SUPPORT_PCRE32 */