ruby-changes:30058
From: glass <ko1@a...>
Date: Mon, 22 Jul 2013 17:37:59 +0900 (JST)
Subject: [ruby-changes:30058] glass:r42110 (trunk): * string.c (rb_str_each_char_size): performance implement by
glass 2013-07-22 17:37:46 +0900 (Mon, 22 Jul 2013) New Revision: 42110 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42110 Log: * string.c (rb_str_each_char_size): performance implement by using rb_str_length(). Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42109) +++ ChangeLog (revision 42110) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jul 22 17:24:14 2013 Masaki Matsushita <glass.saga@g...> + + * string.c (rb_str_each_char_size): performance implement by + using rb_str_length(). + Mon Jul 22 16:32:48 2013 Nobuyoshi Nakada <nobu@r...> * vm_eval.c (eval_string_with_cref): check by Check_TypedStruct Index: string.c =================================================================== --- string.c (revision 42109) +++ string.c (revision 42110) @@ -6501,16 +6501,7 @@ rb_str_bytes(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L6501 static VALUE rb_str_each_char_size(VALUE str, VALUE args, VALUE eobj) { - long len = RSTRING_LEN(str); - if (!single_byte_optimizable(str)) { - const char *ptr = RSTRING_PTR(str); - rb_encoding *enc = rb_enc_get(str); - const char *end_ptr = ptr + len; - for (len = 0; ptr < end_ptr; ++len) { - ptr += rb_enc_mbclen(ptr, end_ptr, enc); - } - } - return LONG2FIX(len); + return rb_str_length(str); } static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/