ruby-changes:45777
From: naruse <ko1@a...>
Date: Sun, 12 Mar 2017 00:03:54 +0900 (JST)
Subject: [ruby-changes:45777] naruse:r57850 (ruby_2_4): merge revision(s) 57283, 57284: [Backport #13113]
naruse 2017-03-12 00:03:50 +0900 (Sun, 12 Mar 2017) New Revision: 57850 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57850 Log: merge revision(s) 57283,57284: [Backport #13113] benchmarks for [Bug #13113] [ci skip] variable.c: resolve permanent name only * variable.c (rb_const_set): resolve and cache class name immediately only if the outer class/module has the name, otherwise just set the ID. [ruby-core:79007] [Bug #13113] Added files: branches/ruby_2_4/benchmark/bm_vm2_module_ann_const_set.rb branches/ruby_2_4/benchmark/bm_vm2_module_const_set.rb Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/variable.c branches/ruby_2_4/version.h Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 57849) +++ ruby_2_4/version.h (revision 57850) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.0" -#define RUBY_RELEASE_DATE "2017-03-11" -#define RUBY_PATCHLEVEL 17 +#define RUBY_RELEASE_DATE "2017-03-12" +#define RUBY_PATCHLEVEL 18 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 11 +#define RUBY_RELEASE_DAY 12 #include "ruby/version.h" Index: ruby_2_4/benchmark/bm_vm2_module_const_set.rb =================================================================== --- ruby_2_4/benchmark/bm_vm2_module_const_set.rb (revision 0) +++ ruby_2_4/benchmark/bm_vm2_module_const_set.rb (revision 57850) @@ -0,0 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/benchmark/bm_vm2_module_const_set.rb#L1 +i = 0 +module M +end +$VERBOSE = nil +while i<6_000_000 # benchmark loop 2 + i += 1 + M.const_set(:X, Module.new) +end Property changes on: ruby_2_4/benchmark/bm_vm2_module_const_set.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: ruby_2_4/benchmark/bm_vm2_module_ann_const_set.rb =================================================================== --- ruby_2_4/benchmark/bm_vm2_module_ann_const_set.rb (revision 0) +++ ruby_2_4/benchmark/bm_vm2_module_ann_const_set.rb (revision 57850) @@ -0,0 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/benchmark/bm_vm2_module_ann_const_set.rb#L1 +i = 0 +while i<6_000_000 # benchmark loop 2 + i += 1 + Module.new.const_set(:X, Module.new) +end Property changes on: ruby_2_4/benchmark/bm_vm2_module_ann_const_set.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: ruby_2_4/variable.c =================================================================== --- ruby_2_4/variable.c (revision 57849) +++ ruby_2_4/variable.c (revision 57850) @@ -2608,7 +2608,12 @@ rb_const_set(VALUE klass, ID id, VALUE v https://github.com/ruby/ruby/blob/trunk/ruby_2_4/variable.c#L2608 * and avoid order-dependency on const_tbl */ if (rb_cObject && (RB_TYPE_P(val, T_MODULE) || RB_TYPE_P(val, T_CLASS))) { - rb_class_name(val); + if (!NIL_P(rb_class_path_cached(val))) { + rb_name_class(val, id); + if (rb_class_path_cached(klass)) { + rb_class_name(val); + } + } } } @@ -2656,7 +2661,8 @@ const_tbl_update(struct autoload_const_s https://github.com/ruby/ruby/blob/trunk/ruby_2_4/variable.c#L2661 } rb_clear_constant_cache(); setup_const_entry(ce, klass, val, visibility); - } else { + } + else { rb_clear_constant_cache(); ce = ZALLOC(rb_const_entry_t); Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r57283-57284 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/