[svn:parrot] r48853 - trunk/src/string/encoding

luben at svn.parrot.org luben at svn.parrot.org
Wed Sep 8 08:33:02 UTC 2010


Author: luben
Date: Wed Sep  8 08:33:02 2010
New Revision: 48853
URL: https://trac.parrot.org/parrot/changeset/48853

Log:
Speed up equality check of same encoding multibyte strings

Now when charset and encoding are one structure, we
can memcmp between strings of same enconding

Modified:
   trunk/src/string/encoding/shared.c

Modified: trunk/src/string/encoding/shared.c
==============================================================================
--- trunk/src/string/encoding/shared.c	Wed Sep  8 08:23:25 2010	(r48852)
+++ trunk/src/string/encoding/shared.c	Wed Sep  8 08:33:02 2010	(r48853)
@@ -77,6 +77,8 @@
         return 1;
     if (lhs->hashval && rhs->hashval && lhs->hashval != rhs->hashval)
         return 0;
+    if (lhs->encoding == rhs->encoding)
+        return memcmp(lhs->strstart, rhs->strstart, STRING_byte_length(lhs)) == 0;
 
     STRING_ITER_INIT(interp, &l_iter);
     STRING_ITER_INIT(interp, &r_iter);


More information about the parrot-commits mailing list