perf_check 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/perf_check +2 -2
- data/lib/perf_check/railtie.rb +2 -1
- data/lib/perf_check.rb +10 -4
- 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: 2fa536f7c7af14d67a6489e83df8d214198d26f5
|
4
|
+
data.tar.gz: f6cc644442eb0e543487ffd502b3d721c2288565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c51faf695bbb85bc11fd9b7240cd84dc7ccc01b0caefdeb9ab1d5c709a8934072f1204e28d1e9a9f655539fe91706a8906713de84c0d38d4b922aae31ed824
|
7
|
+
data.tar.gz: 8004ceeb790ee66f23950acd15f3d894ad646b82bbe015443fb3bbce3eee149941ff0346572f9bc4281548d32f39a23b4eed98e562d117d68f8fd4845255ba5d
|
data/bin/perf_check
CHANGED
@@ -51,8 +51,8 @@ opts = OptionParser.new do |opts|
|
|
51
51
|
options.reference = nil
|
52
52
|
end
|
53
53
|
|
54
|
-
opts.on('--
|
55
|
-
|
54
|
+
opts.on('--no-caching', 'Do not enable fragment caching') do
|
55
|
+
ENV['PERF_CHECK_NOCACHING'] = true
|
56
56
|
end
|
57
57
|
|
58
58
|
opts.on('--302-success', 'Consider HTTP 302 code a successful request') do
|
data/lib/perf_check/railtie.rb
CHANGED
@@ -17,8 +17,9 @@ class PerfCheck
|
|
17
17
|
config = Rails::Application::Configuration
|
18
18
|
config.send(:define_method, :cache_classes){ true }
|
19
19
|
|
20
|
+
fragment_caching = !ENV['PERF_CHECK_NOCACHING']
|
20
21
|
config = ActiveSupport::Configurable::Configuration
|
21
|
-
config.send(:define_method, :perform_caching){
|
22
|
+
config.send(:define_method, :perform_caching){ fragment_caching }
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
data/lib/perf_check.rb
CHANGED
@@ -86,11 +86,17 @@ class PerfCheck
|
|
86
86
|
|
87
87
|
master_latency = sprintf('%.1fms', test.reference_latency)
|
88
88
|
this_latency = sprintf('%.1fms', test.this_latency)
|
89
|
-
|
90
89
|
difference = sprintf('%+.1fms', test.latency_difference)
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
|
91
|
+
if test.latency_difference < 0
|
92
|
+
change_factor = test.reference_latency / test.this_latency
|
93
|
+
else
|
94
|
+
change_factor = test.this_latency / test.reference_latency
|
95
|
+
end
|
96
|
+
formatted_change = sprintf('%.1fx', change_factor)
|
97
|
+
|
98
|
+
percent_change = 100*(test.latency_difference / test.reference_latency).abs
|
99
|
+
if percent_change < 10
|
94
100
|
formatted_change = "yours is about the same"
|
95
101
|
color = :blue
|
96
102
|
elsif test.latency_difference < 0
|