mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11d36a49c7
commit
6e21b611aa
3 changed files with 11 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Oct 20 02:23:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* lib/unicode_normalize.rb: (unicode_normalize!): change method name.
|
||||
|
|
|
@ -1132,7 +1132,8 @@ rb_ivar_get(VALUE obj, ID id)
|
|||
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;
|
||||
|
|
|
@ -526,7 +526,8 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_call_info_t *ci, int is_attr)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue