Created
February 1, 2021 12:56
-
-
Save jlsherrill/7544fcdc498985b2706abe67e52d714e to your computer and use it in GitHub Desktop.
testing applicability speed
This file contains hidden or 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
#testing applicability speed | |
def time | |
a = Time.now | |
yield | |
Time.now - a | |
end | |
count = 300 | |
offset = rand(Katello::Host::ContentFacet.count) - count | |
offet = 0 if offset < 0 | |
total_time = 0 | |
Katello::Host::ContentFacet.offset(offset).limit(count).each do |cf| | |
total_time += time do | |
cf.calculate_and_import_applicability | |
end | |
end | |
total_time/count.to_f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment