padrino-performance 0.12.6 → 0.13.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -14
- data/lib/padrino-performance/version.rb +1 -1
- data/test/helper.rb +1 -9
- data/test/test_os.rb +0 -1
- metadata +7 -11
- data/test/bench_core.rb +0 -186
- data/test/mem_core.rb +0 -122
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e63819cf4b90ff4f273691b1636e498ba9f06c58
|
4
|
+
data.tar.gz: 65952b48bfe6ca099121940b92dfaa3c44f3028c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 898993c7968ad0f74fbae2ade51dc93b913d9f3dd6c7be63d4a2becdd10589518cf8fc615619f6faaf35fd1f9cd4ff9a1cab0219514664b5142b331c81379af5
|
7
|
+
data.tar.gz: fa29b937c7a9ebd93b9e55c235638704ebef1158b33b93cf241738f9b8a8d6fd51f3acf4088daeefe464ed52c057c4b4e7f31cd57064ac5de71ed7ffa6ac92d3
|
data/Rakefile
CHANGED
@@ -1,15 +1 @@
|
|
1
|
-
# coding:utf-8
|
2
|
-
RAKE_ROOT = __FILE__
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
1
|
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
|
6
|
-
|
7
|
-
Rake::TestTask.new(:bench) do |test|
|
8
|
-
test.libs << 'test'
|
9
|
-
test.test_files = Dir['test/**/bench_*.rb']
|
10
|
-
end
|
11
|
-
|
12
|
-
Rake::TestTask.new(:mem) do |test|
|
13
|
-
test.libs << 'test'
|
14
|
-
test.test_files = Dir['test/**/mem_*.rb']
|
15
|
-
end
|
data/test/helper.rb
CHANGED
@@ -1,12 +1,4 @@
|
|
1
|
-
require File.expand_path('../../../load_paths', __FILE__)
|
2
|
-
|
3
1
|
require 'minitest/autorun'
|
4
2
|
require 'minitest/pride'
|
5
|
-
require 'padrino-core'
|
6
|
-
require 'padrino-performance'
|
7
|
-
require 'rack'
|
8
3
|
require 'rack/test'
|
9
|
-
|
10
|
-
class MiniTest::Spec
|
11
|
-
include Rack::Test::Methods
|
12
|
-
end
|
4
|
+
require 'padrino-performance'
|
data/test/test_os.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
18
18
|
dependencies: []
|
19
19
|
description: A gem for finding performance problems in Padrino by tracking loads and
|
20
20
|
memory consumption.
|
@@ -34,9 +34,7 @@ files:
|
|
34
34
|
- lib/suites/json.rb
|
35
35
|
- lib/suites/mem.rb
|
36
36
|
- padrino-performance.gemspec
|
37
|
-
- test/bench_core.rb
|
38
37
|
- test/helper.rb
|
39
|
-
- test/mem_core.rb
|
40
38
|
- test/test_os.rb
|
41
39
|
- test/test_padrino_performance.rb
|
42
40
|
homepage: http://www.padrinorb.com
|
@@ -45,29 +43,27 @@ licenses:
|
|
45
43
|
metadata: {}
|
46
44
|
post_install_message:
|
47
45
|
rdoc_options:
|
48
|
-
-
|
46
|
+
- --charset=UTF-8
|
49
47
|
require_paths:
|
50
48
|
- lib
|
51
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
50
|
requirements:
|
53
|
-
- -
|
51
|
+
- - '>='
|
54
52
|
- !ruby/object:Gem::Version
|
55
53
|
version: '0'
|
56
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
55
|
requirements:
|
58
|
-
- -
|
56
|
+
- - '>'
|
59
57
|
- !ruby/object:Gem::Version
|
60
|
-
version: 1.3.
|
58
|
+
version: 1.3.1
|
61
59
|
requirements: []
|
62
60
|
rubyforge_project: padrino-performance
|
63
|
-
rubygems_version: 2.
|
61
|
+
rubygems_version: 2.0.6
|
64
62
|
signing_key:
|
65
63
|
specification_version: 4
|
66
64
|
summary: A gem for finding performance problems in Padrino
|
67
65
|
test_files:
|
68
|
-
- test/bench_core.rb
|
69
66
|
- test/helper.rb
|
70
|
-
- test/mem_core.rb
|
71
67
|
- test/test_os.rb
|
72
68
|
- test/test_padrino_performance.rb
|
73
69
|
has_rdoc:
|
data/test/bench_core.rb
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
ENV['RACK_ENV'] = 'test'
|
2
|
-
|
3
|
-
require 'padrino-core'
|
4
|
-
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'minitest/benchmark'
|
7
|
-
require 'rack/test'
|
8
|
-
|
9
|
-
module MockBenchmark
|
10
|
-
include Rack::Test::Methods
|
11
|
-
|
12
|
-
module Settings
|
13
|
-
def bench_range
|
14
|
-
[20, 80, 320, 1280, 5120]
|
15
|
-
end
|
16
|
-
|
17
|
-
def run(*)
|
18
|
-
puts 'Running ' + self.name
|
19
|
-
super
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.paths
|
24
|
-
@paths ||= (1..100).map{ rand(36**8).to_s(36) }
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.included(base)
|
28
|
-
base.extend Settings
|
29
|
-
end
|
30
|
-
|
31
|
-
def result_code
|
32
|
-
''
|
33
|
-
end
|
34
|
-
|
35
|
-
def app
|
36
|
-
@app
|
37
|
-
end
|
38
|
-
|
39
|
-
module BenchmarkRouting
|
40
|
-
def bench_calling_404
|
41
|
-
assert_performance_linear 0.99 do |n|
|
42
|
-
n.times do
|
43
|
-
get "/#{@paths.sample}_not_found"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
assert_equal 404, last_response.status
|
47
|
-
end
|
48
|
-
|
49
|
-
def bench_calling_one_path
|
50
|
-
assert_performance_linear 0.99 do |n|
|
51
|
-
n.times do
|
52
|
-
get '/foo'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
assert_equal 200, last_response.status
|
56
|
-
end
|
57
|
-
|
58
|
-
def bench_calling_sample
|
59
|
-
assert_performance_linear 0.99 do |n|
|
60
|
-
n.times do
|
61
|
-
get "/#{@paths.sample}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
assert_equal 200, last_response.status
|
65
|
-
end
|
66
|
-
|
67
|
-
def bench_calling_params
|
68
|
-
assert_performance_linear 0.99 do |n|
|
69
|
-
n.times do
|
70
|
-
get "/foo?foo=bar&zoo=#{@paths.sample}"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
assert_equal 200, last_response.status
|
74
|
-
end
|
75
|
-
|
76
|
-
def bench_sample_and_params
|
77
|
-
assert_performance_linear 0.99 do |n|
|
78
|
-
n.times do
|
79
|
-
get "/#{@paths.sample}?foo=bar&zoo=#{@paths.sample}"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
assert_equal 200, last_response.status
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
class Padrino::CoreBenchmark < Minitest::Benchmark
|
88
|
-
include MockBenchmark
|
89
|
-
include MockBenchmark::BenchmarkRouting
|
90
|
-
|
91
|
-
def setup
|
92
|
-
Padrino.clear!
|
93
|
-
|
94
|
-
@app = Sinatra.new Padrino::Application do
|
95
|
-
get("/foo") { "okey" }
|
96
|
-
|
97
|
-
MockBenchmark.paths.each do |p|
|
98
|
-
get("/#{p}") { p.to_s }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
@paths = MockBenchmark.paths
|
103
|
-
|
104
|
-
get '/'
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
class SinatraBenchmark < Minitest::Benchmark
|
109
|
-
include MockBenchmark
|
110
|
-
include MockBenchmark::BenchmarkRouting
|
111
|
-
|
112
|
-
def setup
|
113
|
-
@app = Sinatra.new do
|
114
|
-
get("/foo") { "okey" }
|
115
|
-
|
116
|
-
MockBenchmark.paths.each do |p|
|
117
|
-
get("/#{p}") { p.to_s }
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
@paths = MockBenchmark.paths
|
122
|
-
|
123
|
-
get '/'
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
class Padrino::MounterBenchmark < Minitest::Benchmark
|
128
|
-
include MockBenchmark
|
129
|
-
|
130
|
-
class TestApp < Padrino::Application
|
131
|
-
get '/' do
|
132
|
-
'OK'
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
def setup
|
137
|
-
Padrino.clear!
|
138
|
-
|
139
|
-
MockBenchmark.paths.each do |p|
|
140
|
-
Padrino.mount(TestApp).to("/#{p}")
|
141
|
-
end
|
142
|
-
|
143
|
-
@paths = MockBenchmark.paths
|
144
|
-
end
|
145
|
-
|
146
|
-
def bench_mounted_sample
|
147
|
-
request = Rack::MockRequest.new(Padrino.application)
|
148
|
-
response = nil
|
149
|
-
assert_performance_linear 0.99 do |n|
|
150
|
-
n.times do
|
151
|
-
response = request.get("/#{@paths.sample}")
|
152
|
-
end
|
153
|
-
end
|
154
|
-
assert_equal 200, response.status
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
class Padrino::HugeRouterBenchmark < Minitest::Benchmark
|
159
|
-
include MockBenchmark
|
160
|
-
|
161
|
-
def setup
|
162
|
-
@apps = {}
|
163
|
-
@pathss = {}
|
164
|
-
@requests = {}
|
165
|
-
self.class.bench_range.each do |n|
|
166
|
-
@pathss[n] = paths = (1..n/20).map{ rand(36**8).to_s(36) }
|
167
|
-
@apps[n] = Sinatra.new Padrino::Application do
|
168
|
-
paths.each do |p|
|
169
|
-
get("/#{p}") { p.to_s }
|
170
|
-
end
|
171
|
-
end
|
172
|
-
@requests[n] = Rack::MockRequest.new(@apps[n])
|
173
|
-
@requests[n].get('/')
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
def bench_calling_sample
|
178
|
-
response = nil
|
179
|
-
assert_performance_linear 0.99 do |n|
|
180
|
-
n.times do
|
181
|
-
response = @requests[n].get("/#{@pathss[n].sample}")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
assert_equal 200, response.status
|
185
|
-
end
|
186
|
-
end
|
data/test/mem_core.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
ENV['RACK_ENV'] = 'test'
|
2
|
-
|
3
|
-
require 'padrino-core'
|
4
|
-
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'minitest/benchmark'
|
7
|
-
require 'rack/test'
|
8
|
-
require 'memory_profiler'
|
9
|
-
|
10
|
-
module MockBenchmark
|
11
|
-
include Rack::Test::Methods
|
12
|
-
|
13
|
-
module Settings
|
14
|
-
def bench_range
|
15
|
-
[20, 80, 320, 1280]
|
16
|
-
end
|
17
|
-
|
18
|
-
def run(*)
|
19
|
-
puts 'Running ' + self.name
|
20
|
-
puts `pmap -x #{$$} | tail -1`
|
21
|
-
report = MemoryProfiler.report do
|
22
|
-
super
|
23
|
-
end
|
24
|
-
puts `pmap -x #{$$} | tail -1`
|
25
|
-
#puts `pmap -x #{$$}`
|
26
|
-
report.pretty_print
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.paths
|
31
|
-
@paths ||= (1..100).map{ rand(36**8).to_s(36) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.included(base)
|
35
|
-
base.extend Settings
|
36
|
-
end
|
37
|
-
|
38
|
-
def result_code
|
39
|
-
''
|
40
|
-
end
|
41
|
-
|
42
|
-
def app
|
43
|
-
@app
|
44
|
-
end
|
45
|
-
|
46
|
-
module BenchmarkRouting
|
47
|
-
def bench_calling_404
|
48
|
-
assert_performance_linear 0.99 do |n|
|
49
|
-
n.times do
|
50
|
-
get "/#{@paths.sample}_not_found"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
assert_equal 404, last_response.status
|
54
|
-
end
|
55
|
-
|
56
|
-
def bench_calling_one_path
|
57
|
-
assert_performance_linear 0.99 do |n|
|
58
|
-
n.times do
|
59
|
-
get '/foo'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
assert_equal 200, last_response.status
|
63
|
-
end
|
64
|
-
|
65
|
-
def bench_calling_sample
|
66
|
-
assert_performance_linear 0.99 do |n|
|
67
|
-
n.times do
|
68
|
-
get "/#{@paths.sample}"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
assert_equal 200, last_response.status
|
72
|
-
end
|
73
|
-
|
74
|
-
def bench_calling_params
|
75
|
-
assert_performance_linear 0.99 do |n|
|
76
|
-
n.times do
|
77
|
-
get "/foo?foo=bar&zoo=#{@paths.sample}"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
assert_equal 200, last_response.status
|
81
|
-
end
|
82
|
-
|
83
|
-
def bench_sample_and_params
|
84
|
-
assert_performance_linear 0.99 do |n|
|
85
|
-
n.times do
|
86
|
-
get "/#{@paths.sample}?foo=bar&zoo=#{@paths.sample}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
assert_equal 200, last_response.status
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class Padrino::HugeRouterBenchmark < Minitest::Benchmark
|
95
|
-
include MockBenchmark
|
96
|
-
|
97
|
-
def setup
|
98
|
-
@apps = {}
|
99
|
-
@pathss = {}
|
100
|
-
@requests = {}
|
101
|
-
self.class.bench_range.each do |n|
|
102
|
-
@pathss[n] = paths = (1..n/20).map{ rand(36**8).to_s(36) }
|
103
|
-
@apps[n] = Sinatra.new Padrino::Application do
|
104
|
-
paths.each do |p|
|
105
|
-
get("/#{p}") { p.to_s }
|
106
|
-
end
|
107
|
-
end
|
108
|
-
@requests[n] = Rack::MockRequest.new(@apps[n])
|
109
|
-
@requests[n].get('/')
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def bench_calling_sample
|
114
|
-
response = nil
|
115
|
-
assert_performance_linear 0.99 do |n|
|
116
|
-
n.times do
|
117
|
-
response = @requests[n].get("/#{@pathss[n].sample}")
|
118
|
-
end
|
119
|
-
end
|
120
|
-
assert_equal 200, response.status
|
121
|
-
end
|
122
|
-
end
|