padrino-performance 0.16.0.pre4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7416c298b080e7a580798e5ff9b8dbf473709cf45908f1e7f47b1e67884af04
4
- data.tar.gz: e8db7de9a0f1da8917aedc6e7f2bc5e4d763bb06a5851e80c690cd13ffadb63c
3
+ metadata.gz: bd41f4af095c68b1fa5d6d894e03837a275ce290ec5011c434d2560dda9d40f9
4
+ data.tar.gz: 6befebafa94738622a8fe231d7e0bf506de31a44ac7d91f76eb7c9f7cd52d85b
5
5
  SHA512:
6
- metadata.gz: 223473a6182606c8e5fcc8d6a9d9c8476a21f9282bb39a28b23d08d8f0be0ab4986907b491739f92a78a10003cc9050b8cd8fcfa6597dc23a1b8ace1bc4e7ea9
7
- data.tar.gz: 69357f3d0361564d22a48974cfdd8475b2f0c45e35a8f990846debf6d752d1db6ac96e2e50bae6f5baf34f4765ab3b981670e4ce05ebf6c9bc94c62652dd6944
6
+ metadata.gz: 48e3e287cac75bfe129feee24d3451fdf10140604ffccc67370177d5766e2d52ac4542e50c6288aaadf5094c8d816114177c38b07cf4a5d438bc8e68da29913c
7
+ data.tar.gz: f5f457372ff50a95749fd3b7a18dba1284a80f8760b76ea7e0a9e3b5465d8a78574c064b8d0f3e5e167fcc219b9f6ec931686638b173ac8584e9bcfe55d5373c
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
1
+ require_relative '../gem_rake_helper'
2
2
 
3
3
  Rake::TestTask.new(:bench) do |test|
4
4
  test.libs << 'test'
@@ -2,25 +2,25 @@
2
2
  require 'optparse'
3
3
  require 'rbconfig'
4
4
 
5
- padrino_perf_path = File.expand_path('../../lib', __FILE__)
5
+ padrino_perf_path = File.expand_path('../lib', __dir__)
6
6
 
7
7
  argv = []
8
8
  OptionParser.new do |opts|
9
- opts.banner = "Usage: padrino-performance [options]"
9
+ opts.banner = 'Usage: padrino-performance [options]'
10
10
 
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"))
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("-m", "--mem", "Print memory consumption") do |v|
16
- argv << '-r' + File.expand_path(File.join(padrino_perf_path, "suites", "mem"))
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
- sub(/.*\s.*/m, '"\&"')
23
+ RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
24
+ ).sub(/.*\s.*/m, '"\&"')
25
25
 
26
- exec({"RUBYOPT" => argv.join("")}, *[RUBY, "-S", *ARGV])
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
- (/darwin/ =~ RbConfig::CONFIG['target_os']) != nil
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? and not self.mac?
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 # InfectedRequire
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
- if loaded_libs.size >= 2
28
- warn <<-WARN
29
- Concurring json libraries have been loaded. This incurs an
30
- unneccessary 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
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!("json", "json_pure", "yajl-ruby", "oj", "crack")
49
- end # JSON
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 #{$$} | tail -5"
18
+ "vmmap #{$PROCESS_ID} | tail -5"
18
19
  elsif Performance::OS.linux?
19
- "pmap #{$$} | tail -1"
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
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env gem build
2
2
  # encoding: utf-8
3
3
 
4
- require File.expand_path("../lib/padrino-performance/version.rb", __FILE__)
4
+ require File.expand_path('lib/padrino-performance/version.rb', __dir__)
5
5
 
6
6
  Gem::Specification.new do |s|
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"
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("%Y-%m-%d")
16
- s.license = "MIT"
15
+ s.date = Time.now.strftime('%Y-%m-%d')
16
+ s.license = 'MIT'
17
17
 
18
- s.extra_rdoc_files = Dir["*.rdoc"]
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 = ["padrino-performance"]
22
- s.require_paths = ["lib"]
23
- s.rdoc_options = ["--charset=UTF-8"]
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 'Running ' + self.name
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("/foo") { "okey" }
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("/foo") { "okey" }
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 'Running ' + self.name
19
- puts `pmap -x #{$$} | tail -1`
19
+ puts "Running #{self.name}"
20
+ puts `pmap -x #{$PROCESS_ID} | tail -1`
20
21
  super
21
- puts `pmap -x #{$$} | tail -1`
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
- require File.expand_path(File.dirname(__FILE__) + '/helper')
1
+ require_relative 'helper'
2
2
 
3
- describe "Padrino Performance OS Module" do
4
- WINDOWS_RELATED_SYSTEMS = %w(cygwin mswin mingw bccwin wince emx)
3
+ describe 'Padrino Performance OS Module' do
4
+ WINDOWS_RELATED_SYSTEMS = %w[cygwin mswin mingw bccwin wince emx]
5
5
 
6
- describe "#windows?" do
6
+ describe '#windows?' do
7
7
  it 'should return false if OS is now windows' do
8
- RbConfig::CONFIG['target_os'] = "linux"
9
- refute(Padrino::Performance::OS.windows?, "No non windows system given")
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 "#mac?" do
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?, "We have no Mac related system running")
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?, "We have no Mac related system running")
28
+ refute(Padrino::Performance::OS.mac?, 'We have no Mac related system running')
29
29
  end
30
30
  end
31
31
 
32
- describe "#unix?" do
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?, "We have no windows related system running")
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 "#linux?" do
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.')
@@ -1,5 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/helper')
2
-
3
- describe "Padrino Performance" do
1
+ require_relative 'helper'
4
2
 
3
+ describe 'Padrino Performance' do
5
4
  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.16.0.pre4
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: 2025-11-19 00:00:00.000000000 Z
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.1
60
+ version: 1.3.6
61
61
  requirements: []
62
62
  rubygems_version: 3.4.19
63
63
  signing_key: