Skip to content

Instantly share code, notes, and snippets.

@valakirka
Forked from porras/gist:392390
Created May 6, 2010 17:21
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 valakirka/392410 to your computer and use it in GitHub Desktop.
Save valakirka/392410 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'benchmark'
require 'almodovar' # http://github.com/bebanjo/almodovar
auth = Almodovar::DigestAuth.new("Sequence", "api_user", "secret")
sequence = Almodovar::Resource("http://sequence.local/api", auth)
sequence.work_areas.first.name
# "Bebanjo TV"
sequence.work_areas.first.jobs.first.name
# "Ironman 2"
sequence.work_areas.first.jobs.first.tasks.first.name
# "Encoding"
Benchmark.bm(10) do |bm|
bm.report("No expands") do
sequence.work_areas.first.jobs.first.tasks.first.status
end
bm.report("1 expand") do
sequence.work_areas(:expand => "jobs").first.jobs.first.tasks.first.status
end
bm.report("2 expands") do
sequence.work_areas(:expand => ["jobs", "tasks"]).first.jobs.first.tasks.first.status
end
end
# user system total real
# No expands 0.010000 0.000000 0.010000 ( 3.167401)
# 1 expand 0.010000 0.010000 0.020000 ( 1.937555)
# 2 expands 0.000000 0.000000 0.000000 ( 1.066308)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment