perf_check 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13550dace1b19a0fc59455c8b634a0dc9a7b8912
4
- data.tar.gz: e79ffef57fa5b5aa024f8db462546025c1e16a94
3
+ metadata.gz: 1f95a944bc3ea7c0e6db69ceae559e9907ed098a
4
+ data.tar.gz: 4fa447acd5f53650ac5c90f7f64bb8bbe016a29b
5
5
  SHA512:
6
- metadata.gz: 24264fc1682d64362918466c16207adcd18ff20b23b12d95e9fab160764f90772241c1da34147bf284e12613e83da2e08d7b09514c226c27503b060d69bbb9d8
7
- data.tar.gz: 929f96328a049e05274c3df45fa0b0f6cada648bae987cde175270184755c9c6369a675c9b739c5f3a89d1ff185442e89589afc00782e9ac70308bea89da6ec3
6
+ metadata.gz: ec5adf72039c8e6c37015cff8897627b138b29cf55d247e7f9963c1090cd1a41555f05d5a386171e0154d131a4e6ff435c7ea34134f5a02a389d846bfae36823
7
+ data.tar.gz: 891198f7dfd2caa16786ebfcfc8c36db22b2cbaacaf2f81d86486bd3f49e2c6532b92c235121faab4aef9e23d124f66539dd3564b5ace26a772a33d8a49d300e
@@ -12,8 +12,11 @@ class PerfCheck
12
12
  Rack::MiniProfiler::FileStore.new(:path => tmp)
13
13
  end
14
14
 
15
- # Force cache_classes = true .... :\
16
- Rails::Application::Configuration.send(:define_method, :cache_classes){ true }
15
+ if ENV['PERF_CHECK']
16
+ # Force cache_classes = true .... :\
17
+ config = Rails::Application::Configuration
18
+ config.send(:define_method, :cache_classes){true}
19
+ end
17
20
  end
18
21
  end
19
22
  end
data/lib/perf_check.rb CHANGED
@@ -86,12 +86,15 @@ class PerfCheck
86
86
  this_latency = sprintf('%.1fms', test.this_latency)
87
87
 
88
88
  difference = sprintf('%+.1fms', test.latency_difference)
89
- if test.latency_difference < 0
90
- formatted_change = sprintf('%.1fx', test.latency_factor)
89
+ percent_change = 100 * (test.latency_difference / test.reference_latency).abs
90
+ formatted_change = sprintf('%d%%', percent_change)
91
+ if percent_change < 5
92
+ formatted_change = "yours is about the same"
93
+ color = :blue
94
+ elsif test.latency_difference < 0
91
95
  formatted_change = "yours is #{formatted_change} faster!"
92
96
  color = :green
93
97
  else
94
- formatted_change = sprintf('%.1fx', 1.0 / test.latency_factor)
95
98
  formatted_change = "yours is #{formatted_change} slower!!!"
96
99
  color = :light_red
97
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perf_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubytune