Skip to content

Commit bd8361b

Browse files
committedMay 3, 2015
Don't call looping Module#constants from loop in Type.include_modules_from.
This looping over the same series of direct_superclasses is exponentially redundant and wasteful (not to mention the extra overhead in Module#constants).
1 parent 8c898e7 commit bd8361b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

Diff for: ‎kernel/common/type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def self.include_modules_from(included_module, klass)
322322
changed = true
323323
end
324324

325-
constants_changed ||= mod.constants.any?
325+
constants_changed ||= mod.constant_table.size > 0
326326
end
327327

328328
mod = mod.direct_superclass

0 commit comments

Comments
 (0)