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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d34aaf3aa40817cfe8ac6f6e00357da051c6855
4
- data.tar.gz: 158f5996b44d75d5999909952715068f1f5f3984
3
+ metadata.gz: 2fa536f7c7af14d67a6489e83df8d214198d26f5
4
+ data.tar.gz: f6cc644442eb0e543487ffd502b3d721c2288565
5
5
  SHA512:
6
- metadata.gz: ff7b9258d900af3f851ffa546b05851b49995861e31c3e866d82c47141ba21a54a694bf08d2da8bebd615fddcf601d710521d44aee1e10baa811c3b0d3ca98b0
7
- data.tar.gz: edd58cb96e37aa5dfbb1dd3125d737f42a04f0db52d52e0880289131dd0e4a347ee68eb91fba25a3f9622e485880e0760a959080195b1015890551ba6f7f7dcf
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('--clear-cache', 'Call Rails.cache.clear before running benchmark') do
55
- options.clear_cache = true
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
@@ -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){ true }
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
- percent_change = 100 * (test.latency_difference / test.reference_latency).abs
92
- formatted_change = sprintf('%d%%', percent_change)
93
- if percent_change < 5
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
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubytune