[macruby-changes] [5079] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 24 03:44:36 PST 2010


Revision: 5079
          http://trac.macosforge.org/projects/ruby/changeset/5079
Author:   vincent.isambart at gmail.com
Date:     2010-12-24 03:44:32 -0800 (Fri, 24 Dec 2010)
Log Message:
-----------
added a comment not to forget a possible optimization and fixed a possible bugs in strings

Modified Paths:
--------------
    MacRuby/trunk/NSArray.m
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/NSArray.m
===================================================================
--- MacRuby/trunk/NSArray.m	2010-12-23 17:09:39 UTC (rev 5078)
+++ MacRuby/trunk/NSArray.m	2010-12-24 11:44:32 UTC (rev 5079)
@@ -1155,6 +1155,11 @@
     return rb_ary_join(arg[0], arg[1]);
 }
 
+// TODO: Make it faster.
+// rdoc spends a lot of time resizing strings concatenated by rb_ary_join.
+// Resizing the string buffer using str_resize_bytes with something close
+// to the final size before starting the concatenations would probably
+// make it much faster.
 VALUE
 rb_ary_join(VALUE ary, VALUE sep)
 {

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2010-12-23 17:09:39 UTC (rev 5078)
+++ MacRuby/trunk/string.c	2010-12-24 11:44:32 UTC (rev 5079)
@@ -278,6 +278,7 @@
 static void
 str_append_uchar32(rb_str_t *self, UChar32 c)
 {
+    str_reset_flags(self);
     if ((c <= 127) && self->encoding->ascii_compatible) {
 	str_resize_bytes(self, self->length_in_bytes + 1);
 	self->bytes[self->length_in_bytes] = c;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101224/83009fea/attachment.html>


More information about the macruby-changes mailing list