From: naruse@... Date: 2017-03-11T15:03:55+00:00 Subject: [ruby-core:80023] [Ruby trunk Bug#13113] Performance issue, const_set Module.new is too slow in Ruby 2.4 Issue #13113 has been updated by Yui NARUSE. Backport changed from 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE ruby_2_4 r57850 merged revision(s) 57283,57284. ---------------------------------------- Bug #13113: Performance issue, const_set Module.new is too slow in Ruby 2.4 https://bugs.ruby-lang.org/issues/13113#change-63444 * Author: Masataka Kuwabara * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] * Backport: 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE ---------------------------------------- In Ruby 2.4, the following code is too slow. ~~~ ruby 5000000.times { Module.new.const_set(:X, Module.new) } ~~~ In Ruby 2.4, it took 115.68 seconds to run this code. However, in Ruby 2.3.3, it took 7.36 seconds. And if const_set value is not Module.new, it is not slow. For example ~~~ ruby 5000000.times { Module.new.const_set(:X, 2) } ~~~ Ruby versions ~~~ ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux] ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] ~~~ See also. https://github.com/rspec/rspec-core/issues/2365 -- https://bugs.ruby-lang.org/ Unsubscribe: