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 +4 -4
- data/lib/perf_check/railtie.rb +5 -2
- data/lib/perf_check.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f95a944bc3ea7c0e6db69ceae559e9907ed098a
|
4
|
+
data.tar.gz: 4fa447acd5f53650ac5c90f7f64bb8bbe016a29b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec5adf72039c8e6c37015cff8897627b138b29cf55d247e7f9963c1090cd1a41555f05d5a386171e0154d131a4e6ff435c7ea34134f5a02a389d846bfae36823
|
7
|
+
data.tar.gz: 891198f7dfd2caa16786ebfcfc8c36db22b2cbaacaf2f81d86486bd3f49e2c6532b92c235121faab4aef9e23d124f66539dd3564b5ace26a772a33d8a49d300e
|
data/lib/perf_check/railtie.rb
CHANGED
@@ -12,8 +12,11 @@ class PerfCheck
|
|
12
12
|
Rack::MiniProfiler::FileStore.new(:path => tmp)
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
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
|
-
|
90
|
-
|
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
|