develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34343 - trunk/src

From:
chromatic
Date:
December 24, 2008 14:32
Subject:
[svn:parrot] r34343 - trunk/src
Message ID:
20081224223227.5822CCBA12@x12.develooper.com
Author: chromatic
Date: Wed Dec 24 14:32:26 2008
New Revision: 34343

Modified:
   trunk/src/string.c

Log:
[src] Only reallocate destination STRING buffer in string_append() when the
resulting size exceeds (not merely equals) the current buffer size.  This
produces a 12.32% performance improvement in the Rakudo optable-building
benchmark.

Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c	(original)
+++ trunk/src/string.c	Wed Dec 24 14:32:26 2008
@@ -578,7 +578,7 @@
     total_length = a->bufused + b->bufused;
 
     /* make sure A's big enough for both  */
-    if (total_length >= a_capacity)
+    if (total_length > a_capacity)
         Parrot_reallocate_string(interp, a, total_length << 1);
 
     /* A is now ready to receive the contents of B */
@@ -2446,7 +2446,7 @@
         charlen = PObj_buflen(result);
         dp      = (unsigned char *)result->strstart;
 
-        PARROT_ASSERT(i < charlen);
+        PARROT_ASSERT(i <= charlen);
     }
 
     result->bufused = result->strlen = i;



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About