diffbench 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a4d3d583477429f13aa3602a99242c973df03ac
4
+ data.tar.gz: a3db9432157470ef4c07de93e378f6d307799844
5
+ SHA512:
6
+ metadata.gz: 06083ecf29d4c54e71adf9d6c729bc5e187ac3f104b2d8e179daa263fda35bce138ef1e84f28e59d8cb2d03fd344fd5e9ffb1f8f81fac957be7b99ae6833a9c2
7
+ data.tar.gz: 05751c7bf5297c72e8b9dc9c01d4365281d6ffa9fe6e24ebdc007a6fc0aa4e88ad63f65142cb87bff9531412ecaafb0be2db7d2652d100822b16a526a741c325
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: diffbench 0.3.1 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "diffbench"
8
- s.version = "0.3.0"
9
+ s.version = "0.3.1"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Bogdan Gusiev"]
12
- s.date = "2013-06-08"
14
+ s.date = "2015-10-05"
13
15
  s.description = "Diffbench is gem designed to benchmark the performance patches. It can run specified benchmark file before and after some changes made and show performance comparation result"
14
16
  s.email = "agresso@gmail.com"
15
17
  s.executables = ["diffbench"]
@@ -41,12 +43,11 @@ Gem::Specification.new do |s|
41
43
  ]
42
44
  s.homepage = "http://github.com/bogdan/diffbench"
43
45
  s.licenses = ["MIT"]
44
- s.require_paths = ["lib"]
45
- s.rubygems_version = "1.8.24"
46
+ s.rubygems_version = "2.4.5"
46
47
  s.summary = "Benchmark your before and after some changes made"
47
48
 
48
49
  if s.respond_to? :specification_version then
49
- s.specification_version = 3
50
+ s.specification_version = 4
50
51
 
51
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
53
  s.add_runtime_dependency(%q<git>, [">= 0"])
@@ -76,10 +76,9 @@ DOC
76
76
  results.each do |revision, benchmark|
77
77
  output "#{revision}: #{benchmark[test].format}"
78
78
  end
79
- #TODO set improvement
80
- #improvement = improvement_percentage(before_patch, after_patch)
81
- #color_string = result_color(improvement)
82
- #output self.class.color("Improvement: #{improvement}%", color_string).strip
79
+ if results.size == 2
80
+ output_improvement(*results.values.map {|b| b[test]})
81
+ end
83
82
  output ""
84
83
  end
85
84
  end
@@ -117,15 +116,19 @@ DOC
117
116
  output(("-" * (caption.size - test.size)) + test)
118
117
  before_patch = second_run[test]
119
118
  after_patch = first_run[test]
120
- improvement = improvement_percentage(before_patch, after_patch)
121
- color_string = result_color(improvement)
122
119
  output "After patch: #{after_patch.format}"
123
120
  output "Before patch: #{before_patch.format}"
124
- output self.class.color("Improvement: #{improvement}%", color_string).strip
121
+ output_improvement(before_patch, after_patch)
125
122
  output ""
126
123
  end
127
124
  end
128
125
 
126
+ def output_improvement(before, after)
127
+ improvement = improvement_percentage(before, after)
128
+ color_string = result_color(improvement)
129
+ output self.class.color("Improvement: #{improvement}%", color_string).strip
130
+ end
131
+
129
132
  def improvement_percentage(before_patch, after_patch)
130
133
  (((before_patch.real - after_patch.real).to_f / before_patch.real) * 100).round
131
134
  end
@@ -7,6 +7,10 @@ describe DiffBench do
7
7
  Regexp.compile(Regexp.escape(output).gsub("NUM", "[0-9]+"))
8
8
  end
9
9
 
10
+ def improvement_expression
11
+ DiffBench::Runner.color("Improvement: NUM%", :green)
12
+ end
13
+
10
14
  let(:repo) do
11
15
  "#{File.dirname(__FILE__)}/repo"
12
16
  end
@@ -44,14 +48,14 @@ Applying stashed changes back
44
48
 
45
49
  user system total real
46
50
  --------------------------------------------------Sleeper 1
47
- After patch: 0.000000 0.000000 0.000000 ( 0.100NUM)
48
- Before patch: 0.000000 0.000000 0.000000 ( 0.200NUM)
49
- #{DiffBench::Runner.color("Improvement: 50%", :green)}
51
+ After patch: 0.000000 0.000000 0.000000 ( 0.10NUM)
52
+ Before patch: 0.000000 0.000000 0.000000 ( 0.20NUM)
53
+ #{improvement_expression}
50
54
 
51
55
  --------------------------------------------------Sleeper 2
52
- After patch: 0.000000 0.000000 0.000000 ( 0.100NUM)
53
- Before patch: 0.000000 0.000000 0.000000 ( 0.200NUM)
54
- #{DiffBench::Runner.color("Improvement: 50%", :green)}
56
+ After patch: 0.000000 0.000000 0.000000 ( 0.10NUM)
57
+ Before patch: 0.000000 0.000000 0.000000 ( 0.20NUM)
58
+ #{improvement_expression}
55
59
  OUT
56
60
  end
57
61
 
@@ -81,19 +85,19 @@ Checkout to previous HEAD again
81
85
 
82
86
  user system total real
83
87
  --------------------------------------------------Sleeper 1
84
- After patch: 0.000000 0.000000 0.000000 ( 0.100NUM)
85
- Before patch: 0.000000 0.000000 0.000000 ( 0.200NUM)
86
- #{DiffBench::Runner.color("Improvement: 50%", :green)}
88
+ After patch: 0.000000 0.000000 0.000000 ( 0.10NUM)
89
+ Before patch: 0.000000 0.000000 0.000000 ( 0.20NUM)
90
+ #{improvement_expression}
87
91
 
88
92
  --------------------------------------------------Sleeper 2
89
- After patch: 0.000000 0.000000 0.000000 ( 0.100NUM)
90
- Before patch: 0.000000 0.000000 0.000000 ( 0.200NUM)
91
- #{DiffBench::Runner.color("Improvement: 50%", :green)}
93
+ After patch: 0.000000 0.000000 0.000000 ( 0.10NUM)
94
+ Before patch: 0.000000 0.000000 0.000000 ( 0.20NUM)
95
+ #{improvement_expression}
92
96
  OUT
93
97
  end
94
98
 
95
99
  it "should run benchmark for specified revisions" do
96
- revs = `cd #{repo};git log --pretty="%h"`.split("\n")
100
+ revs = `cd #{repo};git log --pretty="%h"`.split("\n").reverse
97
101
  output = `cd #{repo}; ./../../bin/diffbench -r #{revs.join(",")} bench.rb`
98
102
  output.should =~ to_regexp(<<-OUT)
99
103
  Checkout to #{revs.first}
@@ -108,12 +112,14 @@ Checkout to master
108
112
 
109
113
  user system total real
110
114
  --------------------------------------------------Sleeper 1
111
- #{revs.first}: 0.000000 0.000000 0.000000 ( 0.100NUM)
112
- #{revs.last }: 0.000000 0.000000 0.000000 ( 0.200NUM)
115
+ #{revs.first}: 0.000000 0.000000 0.000000 ( 0.10NUM)
116
+ #{revs.last }: 0.000000 0.000000 0.000000 ( 0.20NUM)
117
+ #{improvement_expression}
113
118
 
114
119
  --------------------------------------------------Sleeper 2
115
- #{revs.first}: 0.000000 0.000000 0.000000 ( 0.100NUM)
116
- #{revs.last }: 0.000000 0.000000 0.000000 ( 0.200NUM)
120
+ #{revs.first}: 0.000000 0.000000 0.000000 ( 0.10NUM)
121
+ #{revs.last }: 0.000000 0.000000 0.000000 ( 0.20NUM)
122
+ #{improvement_expression}
117
123
  OUT
118
124
  end
119
125
  end
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffbench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bogdan Gusiev
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-08 00:00:00.000000000 Z
11
+ date: 2015-10-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: git
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: jeweler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: 1.8.3
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: 1.8.3
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: debugger
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: Diffbench is gem designed to benchmark the performance patches. It can
@@ -102,8 +91,8 @@ extra_rdoc_files:
102
91
  - LICENSE.txt
103
92
  - README.md
104
93
  files:
105
- - .document
106
- - .rspec
94
+ - ".document"
95
+ - ".rspec"
107
96
  - Gemfile
108
97
  - LICENSE.txt
109
98
  - README.md
@@ -125,29 +114,25 @@ files:
125
114
  homepage: http://github.com/bogdan/diffbench
126
115
  licenses:
127
116
  - MIT
117
+ metadata: {}
128
118
  post_install_message:
129
119
  rdoc_options: []
130
120
  require_paths:
131
121
  - lib
132
122
  required_ruby_version: !ruby/object:Gem::Requirement
133
- none: false
134
123
  requirements:
135
- - - ! '>='
124
+ - - ">="
136
125
  - !ruby/object:Gem::Version
137
126
  version: '0'
138
- segments:
139
- - 0
140
- hash: -2803528317631854912
141
127
  required_rubygems_version: !ruby/object:Gem::Requirement
142
- none: false
143
128
  requirements:
144
- - - ! '>='
129
+ - - ">="
145
130
  - !ruby/object:Gem::Version
146
131
  version: '0'
147
132
  requirements: []
148
133
  rubyforge_project:
149
- rubygems_version: 1.8.24
134
+ rubygems_version: 2.4.5
150
135
  signing_key:
151
- specification_version: 3
136
+ specification_version: 4
152
137
  summary: Benchmark your before and after some changes made
153
138
  test_files: []