[svn:parrot] r46585 - trunk/src/string

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu May 13 11:35:19 UTC 2010


Author: NotFound
Date: Thu May 13 11:35:19 2010
New Revision: 46585
URL: https://trac.parrot.org/parrot/changeset/46585

Log:
nano-optimization in Parrot_str_find_index

Modified:
   trunk/src/string/api.c

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Thu May 13 11:33:53 2010	(r46584)
+++ trunk/src/string/api.c	Thu May 13 11:35:19 2010	(r46585)
@@ -867,6 +867,10 @@
     if (start >= (INTVAL)len)
         return -1;
 
+    /* Short circuit when s is the same as s2 */
+    if (s == s2)
+        return start == 0 ? 0 : -1;
+
     if (!Parrot_str_length(interp, s2))
         return -1;
     else {


More information about the parrot-commits mailing list