-
-
Save ebeigarts/2bf37ac7b1b2ed1f57dc63e5682655db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/setup' | |
require 'benchmark/ips' | |
require 'active_support/descendants_tracker' | |
class Parent | |
extend ActiveSupport::DescendantsTracker | |
end | |
class Child1 < Parent; end | |
class Child2 < Parent; end | |
class Grandchild1 < Child1; end | |
class Grandchild2 < Child1; end | |
Benchmark.ips do |x| | |
x.report("Parent") { Parent.descendants } | |
x.report("Child") { Child1.descendants } | |
x.report("Grandchild") { Grandchild1.descendants } | |
x.compare! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment