padrino-performance 0.16.0.pre3 → 0.16.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 +1 -1
- data/bin/padrino-performance +9 -9
- data/lib/padrino-performance/os.rb +2 -2
- data/lib/suites/json.rb +16 -18
- data/lib/suites/mem.rb +4 -3
- data/padrino-performance.gemspec +14 -14
- data/test/bench_core.rb +5 -5
- data/test/mem_core.rb +5 -4
- data/test/test_os.rb +12 -12
- data/test/test_padrino_performance.rb +2 -3
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd41f4af095c68b1fa5d6d894e03837a275ce290ec5011c434d2560dda9d40f9
|
|
4
|
+
data.tar.gz: 6befebafa94738622a8fe231d7e0bf506de31a44ac7d91f76eb7c9f7cd52d85b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48e3e287cac75bfe129feee24d3451fdf10140604ffccc67370177d5766e2d52ac4542e50c6288aaadf5094c8d816114177c38b07cf4a5d438bc8e68da29913c
|
|
7
|
+
data.tar.gz: f5f457372ff50a95749fd3b7a18dba1284a80f8760b76ea7e0a9e3b5465d8a78574c064b8d0f3e5e167fcc219b9f6ec931686638b173ac8584e9bcfe55d5373c
|
data/Rakefile
CHANGED
data/bin/padrino-performance
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
require 'optparse'
|
|
3
3
|
require 'rbconfig'
|
|
4
4
|
|
|
5
|
-
padrino_perf_path = File.expand_path('
|
|
5
|
+
padrino_perf_path = File.expand_path('../lib', __dir__)
|
|
6
6
|
|
|
7
7
|
argv = []
|
|
8
8
|
OptionParser.new do |opts|
|
|
9
|
-
opts.banner =
|
|
9
|
+
opts.banner = 'Usage: padrino-performance [options]'
|
|
10
10
|
|
|
11
|
-
opts.on(
|
|
12
|
-
argv <<
|
|
11
|
+
opts.on('-j', '--json', 'Check for multiple loaded json libraries') do |_v|
|
|
12
|
+
argv << "-r#{File.expand_path(File.join(padrino_perf_path, 'suites', 'json'))}"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
opts.on(
|
|
16
|
-
argv <<
|
|
15
|
+
opts.on('-m', '--mem', 'Print memory consumption') do |_v|
|
|
16
|
+
argv << "-r#{File.expand_path(File.join(padrino_perf_path, 'suites', 'mem'))}"
|
|
17
17
|
end
|
|
18
18
|
end.parse!
|
|
19
19
|
|
|
20
20
|
# This little gem is stolen from Rake, thanks Jim!
|
|
21
21
|
RUBY = File.join(
|
|
22
22
|
RbConfig::CONFIG['bindir'],
|
|
23
|
-
RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
|
|
24
|
-
|
|
23
|
+
RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
|
|
24
|
+
).sub(/.*\s.*/m, '"\&"')
|
|
25
25
|
|
|
26
|
-
exec({
|
|
26
|
+
exec({ 'RUBYOPT' => argv.join('') }, RUBY, '-S', *ARGV)
|
|
@@ -8,7 +8,7 @@ module Padrino
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def self.mac?
|
|
11
|
-
|
|
11
|
+
(/darwin/ =~ RbConfig::CONFIG['target_os']) != nil
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def self.unix?
|
|
@@ -16,7 +16,7 @@ module Padrino
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def self.linux?
|
|
19
|
-
self.unix?
|
|
19
|
+
self.unix? && !self.mac?
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
data/lib/suites/json.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Padrino
|
|
|
7
7
|
JSON.loaded_lib!(lib) if JSON.registered_libs.include? lib
|
|
8
8
|
super
|
|
9
9
|
end
|
|
10
|
-
end
|
|
10
|
+
end
|
|
11
11
|
|
|
12
12
|
def self.registered_libs
|
|
13
13
|
@registered_libs ||= []
|
|
@@ -23,20 +23,20 @@ module Padrino
|
|
|
23
23
|
|
|
24
24
|
def self.loaded_lib!(lib)
|
|
25
25
|
loaded_libs[lib] = caller
|
|
26
|
+
return unless loaded_libs.size >= 2
|
|
27
|
+
|
|
28
|
+
warn <<~WARN
|
|
29
|
+
Concurring json libraries have been loaded. This incurs an
|
|
30
|
+
unnecessary memory overhead at should be avoided. Consult the
|
|
31
|
+
following call stacks to see who loaded the offending libraries
|
|
32
|
+
and contact the authors if necessary:"
|
|
33
|
+
WARN
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
and contact the authors if necessary:"
|
|
33
|
-
WARN
|
|
34
|
-
loaded_libs.each do |name, stack|
|
|
35
|
-
$stderr.puts "=================="
|
|
36
|
-
$stderr.puts "libname: " + name
|
|
37
|
-
$stderr.puts "=================="
|
|
38
|
-
$stderr.puts caller
|
|
39
|
-
end
|
|
35
|
+
loaded_libs.each_key do |name|
|
|
36
|
+
$stderr.puts '=================='
|
|
37
|
+
$stderr.puts "libname: #{name}"
|
|
38
|
+
$stderr.puts '=================='
|
|
39
|
+
$stderr.puts caller
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -45,9 +45,7 @@ WARN
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
infect_require!
|
|
48
|
-
setup_captures!(
|
|
49
|
-
end
|
|
50
|
-
# Performance
|
|
48
|
+
setup_captures!('json', 'json_pure', 'yajl-ruby', 'oj', 'crack')
|
|
49
|
+
end
|
|
51
50
|
end
|
|
52
|
-
# Padrino
|
|
53
51
|
end
|
data/lib/suites/mem.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'English'
|
|
1
2
|
module Padrino
|
|
2
3
|
class << self
|
|
3
4
|
def before_load(&block)
|
|
@@ -14,11 +15,11 @@ module Padrino
|
|
|
14
15
|
|
|
15
16
|
def perf_memusage_command
|
|
16
17
|
if Performance::OS.mac?
|
|
17
|
-
"vmmap #{
|
|
18
|
+
"vmmap #{$PROCESS_ID} | tail -5"
|
|
18
19
|
elsif Performance::OS.linux?
|
|
19
|
-
"pmap #{
|
|
20
|
+
"pmap #{$PROCESS_ID} | tail -1"
|
|
20
21
|
elsif Performance::OS.windows?
|
|
21
|
-
"tasklist /FI \"PID eq #{
|
|
22
|
+
"tasklist /FI \"PID eq #{$PROCESS_ID}\""
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
end
|
data/padrino-performance.gemspec
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env gem build
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
|
|
4
|
-
require File.expand_path(
|
|
4
|
+
require File.expand_path('lib/padrino-performance/version.rb', __dir__)
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
|
-
s.name =
|
|
8
|
-
s.authors = [
|
|
9
|
-
s.email =
|
|
10
|
-
s.summary =
|
|
11
|
-
s.homepage =
|
|
12
|
-
s.description =
|
|
13
|
-
s.required_rubygems_version =
|
|
7
|
+
s.name = 'padrino-performance'
|
|
8
|
+
s.authors = ['Padrino Team', 'Nathan Esquenazi', "Davide D'Agostino", 'Arthur Chiu', 'Florian Gilcher', 'Darío Javier Cravero', 'Igor Bochkariov']
|
|
9
|
+
s.email = 'padrinorb@gmail.com'
|
|
10
|
+
s.summary = 'A gem for finding performance problems in Padrino'
|
|
11
|
+
s.homepage = 'http://www.padrinorb.com'
|
|
12
|
+
s.description = 'A gem for finding performance problems in Padrino by tracking loads and memory consumption.'
|
|
13
|
+
s.required_rubygems_version = '>= 1.3.6'
|
|
14
14
|
s.version = Padrino::Performance.version
|
|
15
|
-
s.date = Time.now.strftime(
|
|
16
|
-
s.license =
|
|
15
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
|
16
|
+
s.license = 'MIT'
|
|
17
17
|
|
|
18
|
-
s.extra_rdoc_files = Dir[
|
|
18
|
+
s.extra_rdoc_files = Dir['*.rdoc']
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
|
20
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
21
|
-
s.executables = [
|
|
22
|
-
s.require_paths = [
|
|
23
|
-
s.rdoc_options = [
|
|
21
|
+
s.executables = ['padrino-performance']
|
|
22
|
+
s.require_paths = ['lib']
|
|
23
|
+
s.rdoc_options = ['--charset=UTF-8']
|
|
24
24
|
end
|
data/test/bench_core.rb
CHANGED
|
@@ -15,13 +15,13 @@ module MockBenchmark
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def run(*)
|
|
18
|
-
puts
|
|
18
|
+
puts "Running #{self.name}"
|
|
19
19
|
super
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def self.paths
|
|
24
|
-
@paths ||= (1..100).map{ rand(36**8).to_s(36) }
|
|
24
|
+
@paths ||= (1..100).map { rand(36**8).to_s(36) }
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def self.included(base)
|
|
@@ -92,7 +92,7 @@ class Padrino::CoreBenchmark < Minitest::Benchmark
|
|
|
92
92
|
Padrino.clear!
|
|
93
93
|
|
|
94
94
|
@app = Sinatra.new Padrino::Application do
|
|
95
|
-
get(
|
|
95
|
+
get('/foo') { 'okey' }
|
|
96
96
|
|
|
97
97
|
MockBenchmark.paths.each do |p|
|
|
98
98
|
get("/#{p}") { p.to_s }
|
|
@@ -111,7 +111,7 @@ class SinatraBenchmark < Minitest::Benchmark
|
|
|
111
111
|
|
|
112
112
|
def setup
|
|
113
113
|
@app = Sinatra.new do
|
|
114
|
-
get(
|
|
114
|
+
get('/foo') { 'okey' }
|
|
115
115
|
|
|
116
116
|
MockBenchmark.paths.each do |p|
|
|
117
117
|
get("/#{p}") { p.to_s }
|
|
@@ -163,7 +163,7 @@ class Padrino::HugeRouterBenchmark < Minitest::Benchmark
|
|
|
163
163
|
@pathss = {}
|
|
164
164
|
@requests = {}
|
|
165
165
|
self.class.bench_range.each do |n|
|
|
166
|
-
@pathss[n] = paths = (1..n/20).map{ rand(36**8).to_s(36) }
|
|
166
|
+
@pathss[n] = paths = (1..n / 20).map { rand(36**8).to_s(36) }
|
|
167
167
|
@apps[n] = Sinatra.new Padrino::Application do
|
|
168
168
|
paths.each do |p|
|
|
169
169
|
get("/#{p}") { p.to_s }
|
data/test/mem_core.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'English'
|
|
1
2
|
ENV['RACK_ENV'] = 'test'
|
|
2
3
|
|
|
3
4
|
require 'padrino-core'
|
|
@@ -15,10 +16,10 @@ module MockBenchmark
|
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def run(*)
|
|
18
|
-
puts
|
|
19
|
-
puts `pmap -x #{
|
|
19
|
+
puts "Running #{self.name}"
|
|
20
|
+
puts `pmap -x #{$PROCESS_ID} | tail -1`
|
|
20
21
|
super
|
|
21
|
-
puts `pmap -x #{
|
|
22
|
+
puts `pmap -x #{$PROCESS_ID} | tail -1`
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
|
|
@@ -43,7 +44,7 @@ class Padrino::HugeRouterBenchmark < Minitest::Benchmark
|
|
|
43
44
|
@pathss = {}
|
|
44
45
|
@requests = {}
|
|
45
46
|
self.class.bench_range.each do |n|
|
|
46
|
-
@pathss[n] = paths = (1..n/5).map{ rand(36**8).to_s(36) }
|
|
47
|
+
@pathss[n] = paths = (1..n / 5).map { rand(36**8).to_s(36) }
|
|
47
48
|
@apps[n] = Sinatra.new Padrino::Application do
|
|
48
49
|
paths.each do |p|
|
|
49
50
|
get("/#{p}") { p.to_s }
|
data/test/test_os.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative 'helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
4
|
-
WINDOWS_RELATED_SYSTEMS = %w
|
|
3
|
+
describe 'Padrino Performance OS Module' do
|
|
4
|
+
WINDOWS_RELATED_SYSTEMS = %w[cygwin mswin mingw bccwin wince emx]
|
|
5
5
|
|
|
6
|
-
describe
|
|
6
|
+
describe '#windows?' do
|
|
7
7
|
it 'should return false if OS is now windows' do
|
|
8
|
-
RbConfig::CONFIG['target_os'] =
|
|
9
|
-
refute(Padrino::Performance::OS.windows?,
|
|
8
|
+
RbConfig::CONFIG['target_os'] = 'linux'
|
|
9
|
+
refute(Padrino::Performance::OS.windows?, 'No non windows system given')
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'should return true if we have some windows instance' do
|
|
@@ -17,22 +17,22 @@ describe "Padrino Performance OS Module" do
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
describe
|
|
20
|
+
describe '#mac?' do
|
|
21
21
|
it 'should return true if we have darwin running' do
|
|
22
22
|
RbConfig::CONFIG['target_os'] = 'darwin'
|
|
23
|
-
assert(Padrino::Performance::OS.mac?,
|
|
23
|
+
assert(Padrino::Performance::OS.mac?, 'We have no Mac related system running')
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it 'should return false if we have linux running' do
|
|
27
27
|
RbConfig::CONFIG['target_os'] = 'linux'
|
|
28
|
-
refute(Padrino::Performance::OS.mac?,
|
|
28
|
+
refute(Padrino::Performance::OS.mac?, 'We have no Mac related system running')
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
describe
|
|
32
|
+
describe '#unix?' do
|
|
33
33
|
it 'should return true if OS is not windows' do
|
|
34
34
|
RbConfig::CONFIG['target_os'] = 'linux'
|
|
35
|
-
assert(Padrino::Performance::OS.unix?,
|
|
35
|
+
assert(Padrino::Performance::OS.unix?, 'We have no windows related system running')
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it 'should return false if OS is windows' do
|
|
@@ -43,7 +43,7 @@ describe "Padrino Performance OS Module" do
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
describe
|
|
46
|
+
describe '#linux?' do
|
|
47
47
|
it 'should return true if we have no Windows or Mac related OS' do
|
|
48
48
|
RbConfig::CONFIG['target_os'] = 'linux'
|
|
49
49
|
assert(Padrino::Performance::OS.linux?, 'We have either Mac or Windows operation system.')
|
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.16.0
|
|
4
|
+
version: 0.16.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:
|
|
17
|
+
date: 2025-12-02 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.
|
|
@@ -55,9 +55,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
55
55
|
version: '0'
|
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
|
-
- - "
|
|
58
|
+
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 1.3.
|
|
60
|
+
version: 1.3.6
|
|
61
61
|
requirements: []
|
|
62
62
|
rubygems_version: 3.4.19
|
|
63
63
|
signing_key:
|