markbates (owner)

Revisions

gist: 89590 Download_button fork
public
Public Clone URL: git://gist.github.com/89590.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'pcp_middleware'
require 'benchmark'
 
configatron.sr.pcp.default_partner = 'www'
configatron.sr.pcp.default_configuration_name = 'site'
configatron.sr.pcp.partner.cache = false
configatron.sr.pcp.partner.site = 'https://test_user:abc123@pcp.stage.secondrotation.com'
 
res = Benchmark.realtime do
  10.times do
    partner = SR::PCP::Partner.find_by_subdomain(:www)
    puts partner.object_id
  end
end
 
avg = res/10.0
 
puts "Avg response: #{avg} (false)"
puts "Total response: #{res} (false)"
 
puts "---------------------------------"
 
configatron.sr.pcp.partner.cache = true
 
res = Benchmark.realtime do
  10.times do
    partner = SR::PCP::Partner.find_by_subdomain(:www)
    puts partner.object_id
  end
end
 
avg = res/10.0
 
puts "Avg response: #{avg} (true)"
puts "Total response: #{res} (true)"