viiite 0.1.0

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.
Files changed (67) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/Gemfile +25 -0
  3. data/Gemfile.lock +55 -0
  4. data/LICENCE.md +22 -0
  5. data/Manifest.txt +15 -0
  6. data/README.md +204 -0
  7. data/Rakefile +23 -0
  8. data/bin/viiite +4 -0
  9. data/examples/bench_iteration.rb +9 -0
  10. data/examples/bench_sort.eps +816 -0
  11. data/examples/bench_sort.rash +100 -0
  12. data/examples/bench_sort.rb +38 -0
  13. data/examples/raw.rash +6 -0
  14. data/lib/viiite/command/graph_style.rash +1 -0
  15. data/lib/viiite/command/help.rb +24 -0
  16. data/lib/viiite/command/plot.rb +88 -0
  17. data/lib/viiite/command/report.rb +47 -0
  18. data/lib/viiite/command/run.rb +23 -0
  19. data/lib/viiite/command/serie_style.rash +1 -0
  20. data/lib/viiite/command.rb +45 -0
  21. data/lib/viiite/formatter/plot.rb +38 -0
  22. data/lib/viiite/formatter.rb +5 -0
  23. data/lib/viiite/loader.rb +3 -0
  24. data/lib/viiite/runner.rb +59 -0
  25. data/lib/viiite/tms.rb +89 -0
  26. data/lib/viiite/version.rb +14 -0
  27. data/lib/viiite/viiite_file.rb +20 -0
  28. data/lib/viiite.rb +56 -0
  29. data/spec/fixtures/bench_iteration.rb +9 -0
  30. data/spec/integration/raw_data.rash +6 -0
  31. data/spec/integration/report/viiite_report_1.cmd +1 -0
  32. data/spec/integration/report/viiite_report_1.stdout +7 -0
  33. data/spec/integration/report/viiite_report_2.cmd +1 -0
  34. data/spec/integration/report/viiite_report_2.stdout +10 -0
  35. data/spec/integration/report/viiite_report_3.cmd +1 -0
  36. data/spec/integration/report/viiite_report_3.stdout +18 -0
  37. data/spec/integration/report/viiite_report_4.cmd +1 -0
  38. data/spec/integration/report/viiite_report_4.stdout +22 -0
  39. data/spec/integration/test_command.rb +33 -0
  40. data/spec/integration/viiite/viiite_help.cmd +1 -0
  41. data/spec/integration/viiite/viiite_help.stdout +25 -0
  42. data/spec/spec_helper.rb +23 -0
  43. data/spec/unit/command/test_run.rb +25 -0
  44. data/spec/unit/formatter/plot/test_to_data.rb +16 -0
  45. data/spec/unit/formatter/plot/test_to_dataset.rb +22 -0
  46. data/spec/unit/formatter/plot/test_to_plot.rb +21 -0
  47. data/spec/unit/test_runner.rb +57 -0
  48. data/spec/unit/test_viiite.rb +12 -0
  49. data/spec/unit/tms/test_coerce.rb +46 -0
  50. data/spec/unit/tms/test_divide.rb +26 -0
  51. data/spec/unit/tms/test_minus.rb +26 -0
  52. data/spec/unit/tms/test_plus.rb +34 -0
  53. data/spec/unit/tms/test_times.rb +26 -0
  54. data/spec/unit/tms/test_to_a.rb +11 -0
  55. data/spec/unit/tms/test_to_ruby_literal.rb +11 -0
  56. data/spec/unit/tms/test_to_s.rb +11 -0
  57. data/tasks/clean.rake +3 -0
  58. data/tasks/debug_mail.rake +78 -0
  59. data/tasks/debug_mail.txt +13 -0
  60. data/tasks/gem.rake +68 -0
  61. data/tasks/integration_test.rake +51 -0
  62. data/tasks/spec_test.rake +79 -0
  63. data/tasks/unit_test.rake +77 -0
  64. data/tasks/yard.rake +51 -0
  65. data/viiite.gemspec +192 -0
  66. data/viiite.noespec +40 -0
  67. metadata +297 -0
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # 0.1.0 / 2011-08-20
2
+
3
+ * Enhancements
4
+
5
+ * Birthday!
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :test do
4
+ gem "rake", "~> 0.9.2"
5
+ gem "rspec", "~> 2.6.0"
6
+ end
7
+
8
+ group :release do
9
+ gem "rake", "~> 0.9.2"
10
+ gem "rspec", "~> 2.6.0"
11
+ gem "wlang", "~> 0.10.2"
12
+ end
13
+
14
+ group :doc do
15
+ gem "yard", "~> 0.7.2"
16
+ gem "bluecloth", "~> 2.1.0"
17
+ gem "jekyll", "~> 0.11.0"
18
+ end
19
+
20
+ group :runtime do
21
+ gem "alf", "~> 0.10.0"
22
+ gem "quickl", "~> 0.4.0"
23
+ gem "gnuplot", "~> 2.3.6"
24
+ end
25
+
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ albino (1.3.3)
5
+ posix-spawn (>= 0.3.6)
6
+ alf (0.10.0)
7
+ myrrha (~> 1.2.0)
8
+ quickl (~> 0.4.0)
9
+ bluecloth (2.1.0)
10
+ classifier (1.3.3)
11
+ fast-stemmer (>= 1.0.0)
12
+ diff-lcs (1.1.2)
13
+ directory_watcher (1.4.0)
14
+ fast-stemmer (1.0.0)
15
+ gnuplot (2.3.6)
16
+ jekyll (0.11.0)
17
+ albino (>= 1.3.2)
18
+ classifier (>= 1.3.1)
19
+ directory_watcher (>= 1.1.1)
20
+ kramdown (>= 0.13.2)
21
+ liquid (>= 1.9.0)
22
+ maruku (>= 0.5.9)
23
+ kramdown (0.13.3)
24
+ liquid (2.2.2)
25
+ maruku (0.6.0)
26
+ syntax (>= 1.0.0)
27
+ myrrha (1.2.0)
28
+ posix-spawn (0.3.6)
29
+ quickl (0.4.0)
30
+ rake (0.9.2)
31
+ rspec (2.6.0)
32
+ rspec-core (~> 2.6.0)
33
+ rspec-expectations (~> 2.6.0)
34
+ rspec-mocks (~> 2.6.0)
35
+ rspec-core (2.6.4)
36
+ rspec-expectations (2.6.0)
37
+ diff-lcs (~> 1.1.2)
38
+ rspec-mocks (2.6.0)
39
+ syntax (1.0.0)
40
+ wlang (0.10.2)
41
+ yard (0.7.2)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ alf (~> 0.10.0)
48
+ bluecloth (~> 2.1.0)
49
+ gnuplot (~> 2.3.6)
50
+ jekyll (~> 0.11.0)
51
+ quickl (~> 0.4.0)
52
+ rake (~> 0.9.2)
53
+ rspec (~> 2.6.0)
54
+ wlang (~> 0.10.2)
55
+ yard (~> 0.7.2)
data/LICENCE.md ADDED
@@ -0,0 +1,22 @@
1
+ # The MIT Licence
2
+
3
+ Copyright (c) 2011 - Bernard Lambeau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,15 @@
1
+ viiite.gemspec
2
+ viiite.noespec
3
+ CHANGELOG.md
4
+ Gemfile
5
+ Gemfile.lock
6
+ bin/**/*
7
+ examples/**/*
8
+ lib/**/*
9
+ LICENCE.md
10
+ Manifest.txt
11
+ Rakefile
12
+ README.md
13
+ spec/**/*
14
+ tasks/**/*
15
+ test/**/*
data/README.md ADDED
@@ -0,0 +1,204 @@
1
+ # Viiite
2
+
3
+ Viiite brings tools to benchmark and analyze the complexity of your algorithms.
4
+ It has been designed as an alternative to Benchmark that let your benchmarks
5
+ evolve smoothly from simple measures to more complex infrastructures.
6
+
7
+ [sudo] gem install viiite
8
+
9
+ Viiite uses [semantic versionning](http://semver.org) and has not yet reached the
10
+ public API required for 1.0.0. The safe way to require viiite for now is as
11
+ follows:
12
+
13
+ gem "viiite", "~> 0.1.0"
14
+
15
+ Learn more on the [github-pages of this project](http://blambeau.github.com/viiite)!
16
+
17
+ ## Links
18
+
19
+ * [Github pages with more documentation](http://blambeau.github.com/viiite)
20
+ * [Source code](http://github.com/blambeau/viiite)
21
+
22
+ ## From simple measures ...
23
+
24
+ ```ruby
25
+ require 'viiite'
26
+ n = 15000
27
+ Viiite.bm do |r|
28
+ r.report(:for) { for i in 1..n; a = "1"; end }
29
+ r.report(:times) { n.times do ; a = "1"; end }
30
+ r.report(:upto) { 1.upto(n) do ; a = "1"; end }
31
+ end
32
+ ```
33
+
34
+ ```terminal
35
+ $ viiite report bench_iteration.rb
36
+ +--------+-----------------------------------------------+
37
+ | :bench | :measure |
38
+ +--------+-----------------------------------------------+
39
+ | :for | 0.010000 0.000000 0.010000 ( 0.010454) |
40
+ | :times | 0.000000 0.000000 0.000000 ( 0.002448) |
41
+ | :upto | 0.000000 0.000000 0.000000 ( 0.002451) |
42
+ +--------+-----------------------------------------------+
43
+ ```
44
+
45
+ ## To more complex ones ...
46
+
47
+ ```ruby
48
+ require 'viiite'
49
+ n = 15000
50
+ Viiite.bm do |r|
51
+ r.variation_point :ruby, Viiite.which_ruby
52
+ r.report(:for) { for i in 1..n; a = "1"; end }
53
+ r.report(:times) { n.times do ; a = "1"; end }
54
+ r.report(:upto) { 1.upto(n) do ; a = "1"; end }
55
+ end
56
+ ```
57
+
58
+ ```terminal
59
+ $ rvm exec viiite run bench_iteration.rb | viiite report --hierarchy --regroup=viiite,ruby
60
+ +--------+--------------------------------------------------------------------+
61
+ | :bench | :measure |
62
+ +--------+--------------------------------------------------------------------+
63
+ | :for | +----------------+-----------------------------------------------+ |
64
+ | | | :ruby | :measure | |
65
+ | | +----------------+-----------------------------------------------+ |
66
+ | | | ruby 1.8.7 | 0.010000 0.000000 0.010000 ( 0.009677) | |
67
+ | | | ruby 1.9.3dev | 0.005000 0.000000 0.005000 ( 0.005175) | |
68
+ | | | jruby 1.6.3 | 0.071000 0.000000 0.071000 ( 0.071000) | |
69
+ | | +----------------+-----------------------------------------------+ |
70
+ | :times | +----------------+-----------------------------------------------+ |
71
+ | | | :ruby | :measure | |
72
+ | | +----------------+-----------------------------------------------+ |
73
+ | | | ruby 1.8.7 | 0.000000 0.000000 0.000000 ( 0.003275) | |
74
+ | | | ruby 1.9.3dev | 0.005000 0.000000 0.005000 ( 0.002634) | |
75
+ | | | jruby 1.6.3 | 0.028000 0.000000 0.028000 ( 0.028000) | |
76
+ | | +----------------+-----------------------------------------------+ |
77
+ | ... | ... |
78
+ ```
79
+
80
+ ## To awesomeness ...
81
+
82
+ ```ruby
83
+ require 'viiite'
84
+ Viiite.bm do |b|
85
+ b.variation_point :ruby, Viiite.which_ruby
86
+ b.range_over([100, 200, 300, 400, 500], :size) do |size|
87
+ b.range_over(1..5, :i) do
88
+ bench_case = Array.random(size)
89
+ b.report(:quicksort) { bench_case.quicksort }
90
+ b.report(:bubblesort){ bench_case.bubblesort }
91
+ end
92
+ end
93
+ end
94
+ ```
95
+
96
+ ```terminal
97
+ $ viiite plot bench_sort.rb -x size -y tms.total --graph=ruby --series=viiite --gnuplot | gnuplot
98
+
99
+ ruby 1.8.7
100
+
101
+ 0.35 ++-------+-------+--------+-------+--------+--------+-------+-------++
102
+ + + + + + + bubblesort **A*** +
103
+ | quicksort ##B###*A
104
+ 0.3 ++ ***++
105
+ | *** |
106
+ 0.25 ++ ** ++
107
+ | *** |
108
+ | *** |
109
+ 0.2 ++ *A* ++
110
+ | **** |
111
+ | **** |
112
+ 0.15 ++ *** ++
113
+ | **** |
114
+ | **A* |
115
+ 0.1 ++ ****** ++
116
+ | ****** |
117
+ 0.05 ++ ****A** ++
118
+ | ******** |
119
+ A**** + + + + + + +########B
120
+ 0 B################B################B#################B########-------++
121
+ 100 150 200 250 300 350 400 450 500
122
+
123
+
124
+ ruby 1.9.3dev
125
+
126
+ 0.1 ++-------+-------+--------+-------+--------+--------+-------+-------*A
127
+ + + + + + + bubblesort **A*** +
128
+ | quicksort **B### |
129
+ | ** |
130
+ 0.08 ++ *** ++
131
+ | *** |
132
+ | *A* |
133
+ | *** |
134
+ 0.06 ++ *** ++
135
+ | *** |
136
+ | *** |
137
+ 0.04 ++ *** ++
138
+ | **A* |
139
+ | **** |
140
+ | **** |
141
+ 0.02 ++ **** ++
142
+ | **A** |
143
+ | ****** |
144
+ + ******+ + + + + + +########B
145
+ 0 A**##############B################B#################B########-------++
146
+ 100 150 200 250 300 350 400 450 500
147
+ ```
148
+
149
+ ```terminal
150
+ $ viiite plot bench_sort.rb -x size -y tms.total --graph=viiite --series=ruby --gnuplot | gnuplot
151
+ bubblesort
152
+
153
+ 0.35 ++-------+-------+--------+-------+--------+--------+-------+-------++
154
+ + + + + + + ruby 1.8.7 **A*** +
155
+ | ruby 1.9.3dev ##B### |
156
+ 0.3 ++ ***++
157
+ | *** |
158
+ 0.25 ++ ** ++
159
+ | *** |
160
+ | *** |
161
+ 0.2 ++ *A* ++
162
+ | **** |
163
+ | **** |
164
+ 0.15 ++ *** ++
165
+ | **** |
166
+ | **A* |
167
+ 0.1 ++ ****** ########B
168
+ | ****** ####B######## |
169
+ 0.05 ++ ****A** ######### ++
170
+ | ******** ########B#### |
171
+ A**** ########B########+ + + + + +
172
+ 0 B########+-------+--------+-------+--------+--------+-------+-------++
173
+ 100 150 200 250 300 350 400 450 500
174
+
175
+
176
+ quicksort
177
+
178
+ 0.012 ++-------+-------+--------+-------+--------+-------+--------+------++
179
+ + + + + + + ruby 1.8.7+**A*** +
180
+ | ruby 1.9.3dev ##B### |
181
+ 0.01 ++ **A
182
+ | ****** |
183
+ | ****** |
184
+ 0.008 ++ A** ++
185
+ | ** |
186
+ | ** |
187
+ | * B
188
+ 0.006 ++ ** ##+
189
+ | ** ## |
190
+ | ** # |
191
+ 0.004 ++ * ## ++
192
+ | ** ## |
193
+ | ** ## |
194
+ 0.002 ++ ##B##############**A######## # ++
195
+ | ###### ****** ###### ## |
196
+ + ######+ + ******+ + + ##+## + +
197
+ 0 A****************A**------+-------+--------+-------B--------+------++
198
+ 100 150 200 250 300 350 400 450 500
199
+
200
+ ```
201
+
202
+ ## On the devel side
203
+
204
+ Fork the project on github ... and so on.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ begin
2
+ gem "bundler", "~> 1.0"
3
+ require "bundler/setup"
4
+ rescue LoadError => ex
5
+ puts ex.message
6
+ abort "Bundler failed to load, (did you run 'gem install bundler' ?)"
7
+ end
8
+
9
+ # Dynamically load the gem spec
10
+ $gemspec_file = File.expand_path('../viiite.gemspec', __FILE__)
11
+ $gemspec = Kernel.eval(File.read($gemspec_file))
12
+
13
+ # We run tests by default
14
+ task :default => :test
15
+
16
+ #
17
+ # Install all tasks found in tasks folder
18
+ #
19
+ # See .rake files there for complete documentation.
20
+ #
21
+ Dir["tasks/*.rake"].each do |taskfile|
22
+ instance_eval File.read(taskfile), taskfile
23
+ end
data/bin/viiite ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require "viiite"
4
+ Viiite::Command.run(ARGV, __FILE__)
@@ -0,0 +1,9 @@
1
+ require 'viiite'
2
+ n = 15000
3
+ Viiite.bm do |r|
4
+ r.variation_point :ruby, Viiite.which_ruby
5
+ r.report(:for) { for i in 1..n; a = "1"; end }
6
+ r.report(:times) { n.times do ; a = "1"; end }
7
+ r.report(:upto) { 1.upto(n) do ; a = "1"; end }
8
+ end
9
+