Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Created February 1, 2021 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlsherrill/7544fcdc498985b2706abe67e52d714e to your computer and use it in GitHub Desktop.
Save jlsherrill/7544fcdc498985b2706abe67e52d714e to your computer and use it in GitHub Desktop.
testing applicability speed
#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