automatthew-stevedore 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ examples/concat.rb
2
+ examples/data.yml
3
+ examples/instance_eval.rb
4
+ examples/stats_libs.rb
5
+ examples/variance.rb
6
+ lib/stevedore/class.rb
7
+ lib/stevedore/instance.rb
8
+ lib/stevedore/rsruby.rb
9
+ lib/stevedore/sample.rb
10
+ lib/stevedore/shell_r.rb
11
+ lib/stevedore/stats.rb
12
+ lib/stevedore.rb
13
+ Manifest
14
+ Rakefile
15
+ README
16
+ stevedore.gemspec
17
+ test/helper.rb
18
+ test/test_R.rb
19
+ test/test_sample.rb
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- Version = '0.2.0'
1
+ Version = '0.2.1'
2
2
 
3
3
  task :default => [ :test ]
4
4
 
@@ -12,7 +12,10 @@ begin
12
12
  p.email = "self@automatthew.com"
13
13
  p.ignore_pattern = /^(\.git).+/
14
14
  p.test_pattern = "test/*.rb"
15
+ p.runtime_dependencies = ["ruport"]
15
16
  end
16
- rescue
17
- "(ignored echoe gemification, as you don't have the Right Stuff)"
18
- end
17
+ rescue LoadError
18
+ puts "(ignored echoe gemification, as you don't have the Right Stuff)"
19
+ end
20
+
21
+
@@ -40,10 +40,12 @@ end
40
40
  # interpolate.load("interpolate")
41
41
 
42
42
  run_count, sample_size = 3, 8
43
+ #
44
+ # puts "Measuring #{run_count} runs of #{sample_size} for each test."
45
+ # StringConcat.run([append, interpolate], run_count, sample_size)
46
+ # puts
47
+ # StringConcat.report([append, interpolate])
48
+ # append.dump
49
+ # interpolate.dump
43
50
 
44
- puts "Measuring #{run_count} runs of #{sample_size} for each test."
45
- StringConcat.run([append, interpolate], run_count, sample_size)
46
- puts
47
- StringConcat.report([append, interpolate])
48
- append.dump
49
- interpolate.dump
51
+ StringConcat.compare_instances( 3, 8)
@@ -4,7 +4,7 @@ $:.unshift "#{File.dirname(__FILE__)}/../lib"
4
4
  require 'stevedore'
5
5
 
6
6
  thing = lambda { true }
7
- n = 10000
7
+ n = 1000
8
8
 
9
9
  one_eval = Stevedore.new "One instance eval with several block.call" do
10
10
 
@@ -60,5 +60,4 @@ for_loop = Variances.new "using for loop" do
60
60
  end
61
61
  end
62
62
 
63
- Variances.run_all( 8, 500)
64
- Variances.report_all
63
+ Variances.compare_instances(8, 32)
@@ -1,3 +1,4 @@
1
+ require 'ruport'
1
2
  class Stevedore
2
3
 
3
4
  def self.instances; @instances ||= []; end
@@ -61,19 +62,21 @@ class Stevedore
61
62
  end
62
63
 
63
64
  def self.report(instances)
64
- puts @subject if @subject
65
- name_size = @instances.map { |i| i.name.size }.max
66
- puts "\n%-#{name_size}s %12s %12s %12s %12s %12s" % ["", "Mean", "Stddev", "Minimum", "Median", "Max"]
67
- puts "-" * (name_size + 5 * 13)
68
- instances.sort_by { |i| i.mean }.each do |instance|
69
- puts "%-#{name_size}s %12f %12f %12f %12f %12f" %
70
- [ instance.name, instance.mean, instance.standard_deviation, instance.min, instance.median, instance.max]
65
+ table = Ruport::Data::Table.new :column_names => %w{ desc Mean ratio Stddev Min Median Max }, :alignment => :right
66
+ feeder = Ruport::Data::Feeder.new(table)
67
+ feeder.transform do |r|
68
+ r.attributes.each do |k|
69
+ v = r[k]
70
+ r[k] = ("%.7f" % v).to_f if v.is_a? Float
71
+ end
71
72
  end
72
73
  means = instances.map { |i| i.mean }.sort
73
- baseline = means.shift
74
- diffs = means.map { |m| m / baseline }
75
- puts "Ratio of means: #{diffs.join(', ')}"
76
- puts
74
+ baseline = means.first
75
+ instances.sort_by { |i| i.mean }.each do |i|
76
+ feeder << [ i.name, i.mean, i.mean / baseline, i.standard_deviation, i.min, i.median, i.max]
77
+ end
78
+ table.rename_columns "ratio" => "this/fastest", "desc" => "Description"
79
+ puts table
77
80
  end
78
81
 
79
82
  def self.compare_instances(run_count, sample_size)
@@ -83,7 +86,7 @@ class Stevedore
83
86
  puts "Measuring #{run_count} runs of #{sample_size} for each test."
84
87
  self.run_all(run_count, sample_size)
85
88
  puts
86
- self.report_all
89
+ self.report(@instances)
87
90
  end
88
91
 
89
92
  # Run a small set of samples and use a power test to determine
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{stevedore}
5
- s.version = "0.2.0"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Matthew King"]
9
- s.date = %q{2009-02-09}
9
+ s.date = %q{2009-05-12}
10
10
  s.description = %q{Benchmarking framework with some statistickal stuff}
11
11
  s.email = %q{self@automatthew.com}
12
12
  s.extra_rdoc_files = ["lib/stevedore/class.rb", "lib/stevedore/instance.rb", "lib/stevedore/rsruby.rb", "lib/stevedore/sample.rb", "lib/stevedore/shell_r.rb", "lib/stevedore/stats.rb", "lib/stevedore.rb", "README"]
13
- s.files = ["examples/aliasing.rb", "examples/concat.rb", "examples/data.yml", "examples/instance_eval.rb", "examples/stats_libs.rb", "examples/stevedata/appending_strings.yaml", "examples/stevedata/interpolating_strings.yaml", "examples/variance.rb", "lib/stevedore/class.rb", "lib/stevedore/instance.rb", "lib/stevedore/rsruby.rb", "lib/stevedore/sample.rb", "lib/stevedore/shell_r.rb", "lib/stevedore/stats.rb", "lib/stevedore.rb", "Manifest", "Rakefile", "README", "stevedore.gemspec", "test/helper.rb", "test/test_R.rb", "test/test_sample.rb"]
13
+ s.files = ["examples/concat.rb", "examples/data.yml", "examples/instance_eval.rb", "examples/stats_libs.rb", "examples/variance.rb", "lib/stevedore/class.rb", "lib/stevedore/instance.rb", "lib/stevedore/rsruby.rb", "lib/stevedore/sample.rb", "lib/stevedore/shell_r.rb", "lib/stevedore/stats.rb", "lib/stevedore.rb", "Manifest", "Rakefile", "README", "stevedore.gemspec", "test/helper.rb", "test/test_R.rb", "test/test_sample.rb"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Stevedore", "--main", "README"]
@@ -25,11 +25,11 @@ Gem::Specification.new do |s|
25
25
  s.specification_version = 2
26
26
 
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
- s.add_development_dependency(%q<echoe>, [">= 0"])
28
+ s.add_runtime_dependency(%q<ruport>, [">= 0"])
29
29
  else
30
- s.add_dependency(%q<echoe>, [">= 0"])
30
+ s.add_dependency(%q<ruport>, [">= 0"])
31
31
  end
32
32
  else
33
- s.add_dependency(%q<echoe>, [">= 0"])
33
+ s.add_dependency(%q<ruport>, [">= 0"])
34
34
  end
35
35
  end
@@ -1,8 +1,3 @@
1
- %w{ bacon facon }.each { |dep| require dep }
2
-
3
- Bacon.extend Bacon::TestUnitOutput
4
- Bacon.summary_on_exit
5
-
6
1
  $:.unshift "#{File.dirname(__FILE__)}/../lib"
7
2
  require 'stevedore'
8
3
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automatthew-stevedore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew King
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-09 00:00:00 -08:00
12
+ date: 2009-05-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: echoe
16
+ name: ruport
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -37,13 +38,10 @@ extra_rdoc_files:
37
38
  - lib/stevedore.rb
38
39
  - README
39
40
  files:
40
- - examples/aliasing.rb
41
41
  - examples/concat.rb
42
42
  - examples/data.yml
43
43
  - examples/instance_eval.rb
44
44
  - examples/stats_libs.rb
45
- - examples/stevedata/appending_strings.yaml
46
- - examples/stevedata/interpolating_strings.yaml
47
45
  - examples/variance.rb
48
46
  - lib/stevedore/class.rb
49
47
  - lib/stevedore/instance.rb