ruby-changes:35954
From: nobu <ko1@a...>
Date: Mon, 20 Oct 2014 02:23:54 +0900 (JST)
Subject: [ruby-changes:35954] nobu:r48035 (trunk): variable.c, vm_insnhelper.c: improve performance
nobu 2014-10-20 02:23:31 +0900 (Mon, 20 Oct 2014) New Revision: 48035 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48035 Log: variable.c, vm_insnhelper.c: improve performance * variable.c (rb_ivar_get), vm_insnhelper.c (vm_getivar): improve instance variable retrieval performance by checking ruby_verbose before call of rb_warning and evaluation of its argument. [ruby-core:65786] [Feature #10396] Modified files: trunk/ChangeLog trunk/variable.c trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 48034) +++ ChangeLog (revision 48035) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Oct 20 02:23:27 2014 Nobuyoshi Nakada <nobu@r...> + + * variable.c (rb_ivar_get), vm_insnhelper.c (vm_getivar): improve + instance variable retrieval performance by checking ruby_verbose + before call of rb_warning and evaluation of its argument. + [ruby-core:65786] [Feature #10396] + Sun Oct 19 23:31:29 2014 CHIKANAGA Tomoyuki <nagachika@r...> * lib/unicode_normalize.rb: (unicode_normalize!): change method name. Index: variable.c =================================================================== --- variable.c (revision 48034) +++ variable.c (revision 48035) @@ -1132,7 +1132,8 @@ rb_ivar_get(VALUE obj, ID id) https://github.com/ruby/ruby/blob/trunk/variable.c#L1132 VALUE iv = rb_ivar_lookup(obj, id, Qundef); if (iv == Qundef) { - rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id)); + if (RTEST(ruby_verbose)) + rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id)); iv = Qnil; } return iv; Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 48034) +++ vm_insnhelper.c (revision 48035) @@ -526,7 +526,8 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L526 } if (UNLIKELY(val == Qundef)) { - if (!is_attr) rb_warning("instance variable %s not initialized", rb_id2name(id)); + if (!is_attr && RTEST(ruby_verbose)) + rb_warning("instance variable %s not initialized", rb_id2name(id)); val = Qnil; } return val; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/