padrino-performance 0.13.0.beta3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +5 -0
- data/lib/padrino-performance/version.rb +1 -1
- data/test/bench_core.rb +186 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4380c09f8a9cf03c56e895e4fce407597612d377
|
4
|
+
data.tar.gz: 806104559c20490dfbe9c54d75082615447b9f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eca89b5d4ece01ec0aea62195f6e2856d9b9015951bb8ea0d622ac2d7a78d0fbea15600aa3f88c4d8e4ebe819b75b9ed71ef0c92c0ca47365833d576aae6bcb
|
7
|
+
data.tar.gz: 979bff0670ea3e4321a6dbc5256bb571ad6bca2e4909611c8bb82596220847b4f2361957ed24cb8119d5e2d80233afc49bd33ac0a3a1f57e3a377bc9797ab210
|
data/Rakefile
CHANGED
data/test/bench_core.rb
ADDED
@@ -0,0 +1,186 @@
|
|
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
|
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.13.0
|
4
|
+
version: 0.13.0
|
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: 2015-
|
17
|
+
date: 2015-10-11 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,6 +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
|
37
38
|
- test/helper.rb
|
38
39
|
- test/test_os.rb
|
39
40
|
- test/test_padrino_performance.rb
|
@@ -53,16 +54,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
54
|
version: '0'
|
54
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
56
|
requirements:
|
56
|
-
- - '
|
57
|
+
- - '>='
|
57
58
|
- !ruby/object:Gem::Version
|
58
|
-
version: 1.3.
|
59
|
+
version: 1.3.6
|
59
60
|
requirements: []
|
60
61
|
rubyforge_project: padrino-performance
|
61
|
-
rubygems_version: 2.
|
62
|
+
rubygems_version: 2.4.8
|
62
63
|
signing_key:
|
63
64
|
specification_version: 4
|
64
65
|
summary: A gem for finding performance problems in Padrino
|
65
66
|
test_files:
|
67
|
+
- test/bench_core.rb
|
66
68
|
- test/helper.rb
|
67
69
|
- test/test_os.rb
|
68
70
|
- test/test_padrino_performance.rb
|