Skip to content

Commit

Permalink
Don't call looping Module#constants from loop in Type.include_modules…
Browse files Browse the repository at this point in the history
…_from.

This looping over the same series of direct_superclasses is exponentially
redundant and wasteful (not to mention the extra overhead in Module#constants).
  • Loading branch information
jemc committed May 3, 2015
1 parent 8c898e7 commit bd8361b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/common/type.rb
Expand Up @@ -322,7 +322,7 @@ def self.include_modules_from(included_module, klass)
changed = true
end

constants_changed ||= mod.constants.any?
constants_changed ||= mod.constant_table.size > 0
end

mod = mod.direct_superclass
Expand Down

0 comments on commit bd8361b

Please sign in to comment.