tach 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -11
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/tach.rb +9 -22
- data/tach.gemspec +3 -3
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
= tach
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
WARNING: this is still really rough and results may not be the best yet, working on it.
|
3
|
+
Simple benchmarking with noticeable progress and pretty results.
|
6
4
|
|
7
5
|
== Writing Benchmarks
|
8
6
|
|
@@ -20,15 +18,10 @@ Benchmarks are pretty easy, I'll explain a simple example
|
|
20
18
|
|
21
19
|
end
|
22
20
|
|
23
|
-
The optional argument to meter tells it how many times to run each tach (it defaults to 1)
|
24
|
-
Each tach should have a name, so you can recognize them in the results
|
21
|
+
The optional argument to meter tells it how many times to run each tach (it defaults to 1)
|
22
|
+
Each tach should have a name, so you can recognize them in the results
|
25
23
|
Then inside the tach block you should specify the code you care about comparing.
|
26
|
-
The
|
27
|
-
Each tach will be run all its repetitions in its own thread, with a new thread for each tach.
|
28
|
-
|
29
|
-
BUT BUT, why does my progressbar take longer than the total time listed in the table?
|
30
|
-
Well, displaying the progressbar is kinda slow, but that time doesn't count against the total for the tach.
|
31
|
-
I'll be using tach to help me make it go faster, and then I'll (hopefully remember to) remove this notice!
|
24
|
+
The name of each tach will be displayed as it starts
|
32
25
|
|
33
26
|
== Copyright
|
34
27
|
|
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "tach"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{
|
8
|
+
gem.summary = %Q{Simple benchmarking}
|
9
|
+
gem.description = %Q{Simple benchmarking with noticeable progress and pretty results.}
|
10
10
|
gem.email = "wbeary@engineyard.com"
|
11
11
|
gem.homepage = "http://github.com/geemus/tach"
|
12
12
|
gem.authors = ["geemus (Wesley Beary)"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/tach.rb
CHANGED
@@ -18,19 +18,11 @@ module Tach
|
|
18
18
|
instance_eval(&block)
|
19
19
|
|
20
20
|
Formatador.display_line
|
21
|
-
longest = @benchmarks.map {|benchmark| benchmark[0]}.map {|name| name.length}.max
|
22
|
-
for name, block in @benchmarks
|
23
|
-
@results[name] = run_in_thread("#{name}#{' ' * (longest - name.length)}", @times, &block)
|
24
|
-
end
|
25
|
-
|
26
21
|
data = []
|
27
22
|
for name, block in @benchmarks
|
28
|
-
|
29
|
-
total = value.inject(0) {|sum,item| sum + item}
|
30
|
-
data << { :average => format("%8.6f", (total / value.length)), :tach => name, :total => format("%8.6f", total) }
|
23
|
+
data << { :tach => name, :total => format("%8.6f", run_tach(name, @times, &block)) }
|
31
24
|
end
|
32
|
-
|
33
|
-
Formatador.display_table(data, [:tach, :average, :total])
|
25
|
+
Formatador.display_table(data, [:tach, :total])
|
34
26
|
Formatador.display_line
|
35
27
|
end
|
36
28
|
|
@@ -40,21 +32,16 @@ module Tach
|
|
40
32
|
|
41
33
|
private
|
42
34
|
|
43
|
-
def
|
35
|
+
def run_tach(name, count, &benchmark)
|
36
|
+
GC::start
|
44
37
|
Formatador.display_line(name)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
for index in 1..count
|
49
|
-
instance_eval(&benchmark)
|
50
|
-
end
|
51
|
-
GC::start
|
52
|
-
tach_finish = Time.now
|
53
|
-
Thread.current[:results] << tach_finish.to_f - tach_start.to_f
|
38
|
+
tach_start = Time.now
|
39
|
+
for index in 1..count
|
40
|
+
instance_eval(&benchmark)
|
54
41
|
end
|
55
|
-
|
42
|
+
tach_finish = Time.now
|
56
43
|
Formatador.display_line
|
57
|
-
|
44
|
+
tach_finish - tach_start
|
58
45
|
end
|
59
46
|
|
60
47
|
end
|
data/tach.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tach}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["geemus (Wesley Beary)"]
|
12
12
|
s.date = %q{2010-04-09}
|
13
|
-
s.description = %q{
|
13
|
+
s.description = %q{Simple benchmarking with noticeable progress and pretty results.}
|
14
14
|
s.email = %q{wbeary@engineyard.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.rdoc_options = ["--charset=UTF-8"]
|
31
31
|
s.require_paths = ["lib"]
|
32
32
|
s.rubygems_version = %q{1.3.6}
|
33
|
-
s.summary = %q{
|
33
|
+
s.summary = %q{Simple benchmarking}
|
34
34
|
|
35
35
|
if s.respond_to? :specification_version then
|
36
36
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: "0"
|
44
44
|
type: :development
|
45
45
|
version_requirements: *id002
|
46
|
-
description:
|
46
|
+
description: Simple benchmarking with noticeable progress and pretty results.
|
47
47
|
email: wbeary@engineyard.com
|
48
48
|
executables: []
|
49
49
|
|
@@ -90,6 +90,6 @@ rubyforge_project:
|
|
90
90
|
rubygems_version: 1.3.6
|
91
91
|
signing_key:
|
92
92
|
specification_version: 3
|
93
|
-
summary:
|
93
|
+
summary: Simple benchmarking
|
94
94
|
test_files: []
|
95
95
|
|