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
@@ -0,0 +1,100 @@
1
+ {:bench => :quicksort, :i => 1, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.000931978225708008)}
2
+ {:bench => :bubblesort, :i => 1, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.02,0.0,0.0,0.0,0.0198590755462646)}
3
+ {:bench => :quicksort, :i => 2, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.000818967819213867)}
4
+ {:bench => :bubblesort, :i => 2, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.00999999999999998,0.0,0.0,0.0,0.0110490322113037)}
5
+ {:bench => :quicksort, :i => 3, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.000854969024658203)}
6
+ {:bench => :bubblesort, :i => 3, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.0112569332122803)}
7
+ {:bench => :quicksort, :i => 4, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.000792026519775391)}
8
+ {:bench => :bubblesort, :i => 4, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.02,0.0,0.0,0.0,0.0127270221710205)}
9
+ {:bench => :quicksort, :i => 5, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.000833034515380859)}
10
+ {:bench => :bubblesort, :i => 5, :size => 100, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.010761022567749)}
11
+ {:bench => :quicksort, :i => 1, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00189709663391113)}
12
+ {:bench => :bubblesort, :i => 1, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.06,0.0,0.0,0.0,0.051987886428833)}
13
+ {:bench => :quicksort, :i => 2, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0019068717956543)}
14
+ {:bench => :bubblesort, :i => 2, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.06,0.0,0.0,0.0,0.0540499687194824)}
15
+ {:bench => :quicksort, :i => 3, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00184392929077148)}
16
+ {:bench => :bubblesort, :i => 3, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.06,0.0,0.0,0.0,0.053170919418335)}
17
+ {:bench => :quicksort, :i => 4, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00193214416503906)}
18
+ {:bench => :bubblesort, :i => 4, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.06,0.0,0.0,0.0,0.0532131195068359)}
19
+ {:bench => :quicksort, :i => 5, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00188493728637695)}
20
+ {:bench => :bubblesort, :i => 5, :size => 200, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.04,0.0,0.0,0.0,0.0441248416900635)}
21
+ {:bench => :quicksort, :i => 1, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.0118849277496338)}
22
+ {:bench => :bubblesort, :i => 1, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.12,0.0,0.0,0.0,0.11739706993103)}
23
+ {:bench => :quicksort, :i => 2, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0030369758605957)}
24
+ {:bench => :bubblesort, :i => 2, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.12,0.0,0.0,0.0,0.120995044708252)}
25
+ {:bench => :quicksort, :i => 3, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00286102294921875)}
26
+ {:bench => :bubblesort, :i => 3, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.12,0.0,0.0,0.0,0.117074012756348)}
27
+ {:bench => :quicksort, :i => 4, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00310397148132324)}
28
+ {:bench => :bubblesort, :i => 4, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.11,0.0,0.0,0.0,0.112523078918457)}
29
+ {:bench => :quicksort, :i => 5, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00554203987121582)}
30
+ {:bench => :bubblesort, :i => 5, :size => 300, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.12,0.0,0.0,0.0,0.116988897323608)}
31
+ {:bench => :quicksort, :i => 1, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.00453591346740723)}
32
+ {:bench => :bubblesort, :i => 1, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.19,0.0,0.0,0.0,0.197253942489624)}
33
+ {:bench => :quicksort, :i => 2, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.00448203086853027)}
34
+ {:bench => :bubblesort, :i => 2, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.21,0.0,0.0,0.0,0.26711893081665)}
35
+ {:bench => :quicksort, :i => 3, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.00516200065612793)}
36
+ {:bench => :bubblesort, :i => 3, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.2,0.0,0.0,0.0,0.215794086456299)}
37
+ {:bench => :quicksort, :i => 4, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00426316261291504)}
38
+ {:bench => :bubblesort, :i => 4, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.21,0.0,0.0,0.0,0.210376024246216)}
39
+ {:bench => :quicksort, :i => 5, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.01,0.0,0.0,0.0,0.00404000282287598)}
40
+ {:bench => :bubblesort, :i => 5, :size => 400, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.2,0.0,0.0,0.0,0.198137998580933)}
41
+ {:bench => :quicksort, :i => 1, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0100000000000002,0.0,0.0,0.0,0.0057070255279541)}
42
+ {:bench => :bubblesort, :i => 1, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.31,0.0,0.0,0.0,0.315191030502319)}
43
+ {:bench => :quicksort, :i => 2, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.00999999999999979,0.0,0.0,0.0,0.00527501106262207)}
44
+ {:bench => :bubblesort, :i => 2, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.31,0.0,0.0,0.0,0.315762042999268)}
45
+ {:bench => :quicksort, :i => 3, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0100000000000002,0.0,0.0,0.0,0.0150480270385742)}
46
+ {:bench => :bubblesort, :i => 3, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.32,0.0,0.0,0.0,0.317266941070557)}
47
+ {:bench => :quicksort, :i => 4, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0100000000000002,0.0,0.0,0.0,0.00540494918823242)}
48
+ {:bench => :bubblesort, :i => 4, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.32,0.0,0.0,0.0,0.3280189037323)}
49
+ {:bench => :quicksort, :i => 5, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.0100000000000002,0.0,0.0,0.0,0.0057520866394043)}
50
+ {:bench => :bubblesort, :i => 5, :size => 500, :ruby => "ruby 1.8.7", :tms => Viiite::Tms(0.31,0.0,0.0,0.0,0.31823205947876)}
51
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 1, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0004265308380126953)}
52
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 1, :bench => :bubblesort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0036416053771972656)}
53
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 2, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0003561973571777344)}
54
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 2, :bench => :bubblesort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.003675222396850586)}
55
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 3, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0003838539123535156)}
56
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 3, :bench => :bubblesort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0036492347717285156)}
57
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 4, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00033593177795410156)}
58
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 4, :bench => :bubblesort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.003430604934692383)}
59
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 5, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0003409385681152344)}
60
+ {:ruby => "ruby 1.9.3dev", :size => 100, :i => 5, :bench => :bubblesort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0037250518798828125)}
61
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 1, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0049359798431396484)}
62
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 1, :bench => :bubblesort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.01381993293762207)}
63
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 2, :bench => :quicksort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.0007574558258056641)}
64
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 2, :bench => :bubblesort, :tms => Viiite::Tms(0.020000000000000018,0.0,0.0,0.0,0.019170284271240234)}
65
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 3, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.000804901123046875)}
66
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 3, :bench => :bubblesort, :tms => Viiite::Tms(0.019999999999999962,0.0,0.0,0.0,0.019022464752197266)}
67
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 4, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0008702278137207031)}
68
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 4, :bench => :bubblesort, :tms => Viiite::Tms(0.020000000000000018,0.0,0.0,0.0,0.02009725570678711)}
69
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 5, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0008249282836914062)}
70
+ {:ruby => "ruby 1.9.3dev", :size => 200, :i => 5, :bench => :bubblesort, :tms => Viiite::Tms(0.020000000000000018,0.0,0.0,0.0,0.01993274688720703)}
71
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 1, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0012989044189453125)}
72
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 1, :bench => :bubblesort, :tms => Viiite::Tms(0.03999999999999998,0.0,0.0,0.0,0.03730130195617676)}
73
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 2, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0013666152954101562)}
74
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 2, :bench => :bubblesort, :tms => Viiite::Tms(0.030000000000000027,0.0,0.0,0.0,0.037523508071899414)}
75
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 3, :bench => :quicksort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.0013306140899658203)}
76
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 3, :bench => :bubblesort, :tms => Viiite::Tms(0.039999999999999925,0.0,0.0,0.0,0.039438724517822266)}
77
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 4, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0012905597686767578)}
78
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 4, :bench => :bubblesort, :tms => Viiite::Tms(0.040000000000000036,0.0,0.0,0.0,0.035891056060791016)}
79
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 5, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0013623237609863281)}
80
+ {:ruby => "ruby 1.9.3dev", :size => 300, :i => 5, :bench => :bubblesort, :tms => Viiite::Tms(0.040000000000000036,0.0,0.0,0.0,0.03461289405822754)}
81
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 1, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.001710653305053711)}
82
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 1, :bench => :bubblesort, :tms => Viiite::Tms(0.06999999999999995,0.0,0.0,0.0,0.06537675857543945)}
83
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 2, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0019588470458984375)}
84
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 2, :bench => :bubblesort, :tms => Viiite::Tms(0.06999999999999995,0.0,0.0,0.0,0.06493997573852539)}
85
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 3, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0017993450164794922)}
86
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 3, :bench => :bubblesort, :tms => Viiite::Tms(0.07000000000000006,0.0,0.0,0.0,0.06435179710388184)}
87
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 4, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0017900466918945312)}
88
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 4, :bench => :bubblesort, :tms => Viiite::Tms(0.06999999999999995,0.0,0.0,0.0,0.06733965873718262)}
89
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 5, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0017752647399902344)}
90
+ {:ruby => "ruby 1.9.3dev", :size => 400, :i => 5, :bench => :bubblesort, :tms => Viiite::Tms(0.07000000000000006,0.0,0.0,0.0,0.06759476661682129)}
91
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 1, :bench => :quicksort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.0022673606872558594)}
92
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 1, :bench => :bubblesort, :tms => Viiite::Tms(0.09999999999999987,0.0,0.0,0.0,0.10301375389099121)}
93
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 2, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.0025730133056640625)}
94
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 2, :bench => :bubblesort, :tms => Viiite::Tms(0.1100000000000001,0.0,0.0,0.0,0.10222816467285156)}
95
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 3, :bench => :quicksort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.028038501739501953)}
96
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 3, :bench => :bubblesort, :tms => Viiite::Tms(0.10000000000000009,0.0,0.0,0.0,0.10360383987426758)}
97
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 4, :bench => :quicksort, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.002351999282836914)}
98
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 4, :bench => :bubblesort, :tms => Viiite::Tms(0.08999999999999986,0.0,0.0,0.0,0.10294198989868164)}
99
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 5, :bench => :quicksort, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.00250244140625)}
100
+ {:ruby => "ruby 1.9.3dev", :size => 500, :i => 5, :bench => :bubblesort, :tms => Viiite::Tms(0.10000000000000009,0.0,0.0,0.0,0.09821605682373047)}
@@ -0,0 +1,38 @@
1
+ class Array
2
+
3
+ def self.random(size)
4
+ Array.new(size){ Kernel.rand }
5
+ end
6
+
7
+ def quicksort(list = self)
8
+ return list if list.nil? or list.size <= 1
9
+ less, more = list[1..-1].partition { |i| i < list[0] }
10
+ quicksort(less) + [list[0]] + quicksort(more)
11
+ end
12
+
13
+ def bubblesort(list = self)
14
+ slist = list.clone
15
+ for i in 0..(slist.length - 1)
16
+ for j in 0..(slist.length - i - 2)
17
+ if ( slist[j + 1] <=> slist[j] ) == -1
18
+ slist[j], slist[j + 1] = slist[j + 1], slist[j]
19
+ end
20
+ end
21
+ end
22
+ slist
23
+ end
24
+
25
+ end
26
+
27
+ require 'viiite'
28
+ Viiite.bm do |b|
29
+ b.variation_point :ruby, Viiite.which_ruby
30
+ b.range_over([100, 200, 300, 400, 500], :size) do |size|
31
+ b.range_over(1..5, :i) do
32
+ bench_case = Array.random(size)
33
+ b.report(:quicksort) { bench_case.quicksort }
34
+ b.report(:bubblesort){ bench_case.bubblesort }
35
+ end
36
+ end
37
+ end
38
+
data/examples/raw.rash ADDED
@@ -0,0 +1,6 @@
1
+ {:ruby => "ruby 1.9.2p136", :bench => :for, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.007596015930175781)}
2
+ {:ruby => "ruby 1.9.2p136", :bench => :times, :tms => Viiite::Tms(0.009999999999999953,0.0,0.0,0.0,0.0069234371185302734)}
3
+ {:ruby => "ruby 1.9.2p136", :bench => :upto, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.007051944732666016)}
4
+ {:ruby => "ruby 1.9.2p136", :bench => :for, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.0076732635498046875)}
5
+ {:ruby => "ruby 1.9.2p136", :bench => :times, :tms => Viiite::Tms(0.0,0.0,0.0,0.0,0.00760650634765625)}
6
+ {:ruby => "ruby 1.9.2p136", :bench => :upto, :tms => Viiite::Tms(0.010000000000000009,0.0,0.0,0.0,0.007064342498779297)}
@@ -0,0 +1 @@
1
+ {:grid => nil}
@@ -0,0 +1,24 @@
1
+ module Viiite
2
+ class Command
3
+ #
4
+ # Show help about a specific command
5
+ #
6
+ # SYNOPSIS
7
+ # viiite #{command_name} COMMAND
8
+ #
9
+ class Help < Quickl::Command(__FILE__, __LINE__)
10
+
11
+ # Let NoSuchCommandError be passed to higher stage
12
+ no_react_to Quickl::NoSuchCommand
13
+
14
+ # Command execution
15
+ def execute(args)
16
+ sup = Quickl.super_command(self)
17
+ sub = (args.size != 1) ? sup : Quickl.sub_command!(sup, args.first)
18
+ puts Quickl.help(sub)
19
+ end
20
+
21
+ end # class Help
22
+ end # class Command
23
+ end # module Viiite
24
+
@@ -0,0 +1,88 @@
1
+ module Viiite
2
+ class Command < Quickl::Delegator(__FILE__, __LINE__)
3
+ #
4
+ # Report benchmarking results as a plot
5
+ #
6
+ # SYNOPSIS
7
+ # viiite #{command_name} [BENCHFILE]
8
+ #
9
+ # OPTIONS
10
+ # #{summarized_options}
11
+ #
12
+ class Plot < Quickl::Command(__FILE__, __LINE__)
13
+
14
+ # Install options
15
+ options do |opt|
16
+ @render = :text
17
+ opt.on('--text', "Render output as a text table") do
18
+ @render = :text
19
+ end
20
+
21
+ opt.on("--gnuplot=[TERM]",
22
+ "Render output as a gnuplot text (and terminal)") do |value|
23
+ @render = :gnuplot
24
+ @term = (value || "dumb").to_sym
25
+ end
26
+
27
+ @serie_style = File.expand_path("../serie_style.rash", __FILE__)
28
+ opt.on('--style=FILE', "Specify a style file to use for series") do |value|
29
+ @serie_style = value
30
+ end
31
+
32
+ @graph_style = File.expand_path("../graph_style.rash", __FILE__)
33
+ opt.on('--style=FILE', "Specify a style file to use for graphs") do |value|
34
+ @graph_style = value
35
+ end
36
+
37
+ @abscissa = :size
38
+ opt.on('-x abscissa', "Specify the abscissa attribute") do |value|
39
+ @abscissa = value.to_sym
40
+ end
41
+
42
+ @ordinate = "tms.total"
43
+ opt.on('-y ordinate', "Specify the ordinate attribute") do |value|
44
+ @ordinate = value
45
+ end
46
+
47
+ @series = :bench
48
+ opt.on("--series=ATTR",
49
+ "Specify the attribute to split series") do |value|
50
+ @series = value.to_sym
51
+ end
52
+
53
+ @graph = :ruby
54
+ opt.on('--graph=ATTR',
55
+ "Specify the attribute to split graphs") do |value|
56
+ @graph = value.to_sym
57
+ end
58
+ end
59
+
60
+ def query(op)
61
+ lispy = Alf.lispy
62
+ op = lispy.summarize(op, [@graph, @series, @abscissa].compact,
63
+ {:y => "avg{ #{@ordinate} }"})
64
+ op = lispy.join(op, Alf::Reader.reader(@serie_style))
65
+ op = lispy.rename(op, @graph => :graph, @abscissa => :x, @series => :serie)
66
+ op = lispy.group(op, [:x, :y], :data)
67
+ op = lispy.rename(op, :serie => :title)
68
+ op = lispy.group(op, [:graph], :series, {:allbut => true})
69
+ op = lispy.join(op, Alf::Reader.reader(@graph_style))
70
+ op = lispy.rename(op, :graph => :title)
71
+ op
72
+ end
73
+
74
+ def execute(args)
75
+ raise Quickl::InvalidArgument if args.size > 1
76
+ op = query Alf::Reader.reader(args.first || $stdin)
77
+ case @render
78
+ when :text
79
+ Alf::Renderer.text(op).execute($stdout)
80
+ when :gnuplot
81
+ $stdout << "set terminal #{@term}\n"
82
+ Viiite::Formatter::Plot::to_plots(op.to_a, $stdout)
83
+ end
84
+ end
85
+
86
+ end # class Plot
87
+ end # class Command
88
+ end # module Viiite
@@ -0,0 +1,47 @@
1
+ module Viiite
2
+ class Command
3
+ #
4
+ # Report benchmarking results as a table
5
+ #
6
+ # SYNOPSIS
7
+ # viiite #{command_name} [BENCHFILE]
8
+ #
9
+ # OPTIONS
10
+ # #{summarized_options}
11
+ #
12
+ class Report < Quickl::Command(__FILE__, __LINE__)
13
+
14
+ options do |opt|
15
+
16
+ @regroup = [:bench]
17
+ opt.on("--regroup=x,y,z", Array,
18
+ "Regroup by x, then y, then z, ...") do |group|
19
+ @regroup = group
20
+ end
21
+
22
+ @hierarchy = false
23
+ opt.on('-h', "--hierarchy", "Make a hierarchical regrouping") do
24
+ @hierarchy = true
25
+ end
26
+
27
+ end
28
+
29
+ def query(op)
30
+ lispy = Alf.lispy
31
+ op = lispy.summarize(op, @regroup, :measure => lispy.avg{tms})
32
+ @regroup[1..-1].each do |grouping|
33
+ op = lispy.group(op, [grouping] + [:measure], :measure)
34
+ end if @hierarchy
35
+ op
36
+ end
37
+
38
+ def execute(args)
39
+ raise Quickl::InvalidArgument if args.size > 1
40
+ op = query Alf::Reader.reader(args.first || $stdin)
41
+ Alf::Renderer.text(op).execute($stdout)
42
+ end
43
+
44
+ end # class Report
45
+ end # class Command
46
+ end # module Viiite
47
+
@@ -0,0 +1,23 @@
1
+ module Viiite
2
+ class Command
3
+ #
4
+ # Run a benchmark and output raw data
5
+ #
6
+ # SYNOPSIS
7
+ # viiite #{command_name} [BENCHFILE]
8
+ #
9
+ # OPTIONS
10
+ # #{summarized_options}
11
+ #
12
+ class Run < Quickl::Command(__FILE__, __LINE__)
13
+
14
+ def execute(args)
15
+ raise Quickl::InvalidArgument if args.size > 1
16
+ input = Alf::Reader.reader(args.first || $stdin)
17
+ output = $stdout
18
+ Alf::Renderer.rash(input).execute(output)
19
+ end
20
+
21
+ end # class Run
22
+ end # class Command
23
+ end # module Viiite
@@ -0,0 +1 @@
1
+ {:with => "linespoints"}
@@ -0,0 +1,45 @@
1
+ module Viiite
2
+ #
3
+ # viiite - Benchmark ruby scripts the easy way
4
+ #
5
+ # SYNOPSIS
6
+ # viiite [--version] [--help] COMMAND [cmd opts] ARGS...
7
+ #
8
+ # OPTIONS
9
+ # #{summarized_options}
10
+ #
11
+ # COMMANDS
12
+ # #{summarized_subcommands}
13
+ #
14
+ # DESCRIPTION
15
+ # This command helps you benchmarking ruby applications and manipulating
16
+ # benchmark results very simply.
17
+ #
18
+ # See 'viiite help COMMAND' for more information on a specific command.
19
+ #
20
+ class Command < Quickl::Delegator(__FILE__, __LINE__)
21
+
22
+ # Install options
23
+ options do |opt|
24
+ opt.on("-Idirectory",
25
+ "specify $LOAD_PATH directory (may be used more than once)") do |val|
26
+ $LOAD_PATH.unshift val
27
+ end
28
+ opt.on('-rlibrary',
29
+ "require the library, before executing viiite") do |lib|
30
+ require(lib)
31
+ end
32
+ opt.on_tail("--help", "Show help") do
33
+ raise Quickl::Help
34
+ end
35
+ opt.on_tail("--version", "Show version") do
36
+ raise Quickl::Exit, "viiite #{Viiite::VERSION} (c) 2011, Bernard Lambeau"
37
+ end
38
+ end
39
+
40
+ end # class Command
41
+ end # module Viiite
42
+ require "viiite/command/help"
43
+ require "viiite/command/run"
44
+ require "viiite/command/report"
45
+ require "viiite/command/plot"
@@ -0,0 +1,38 @@
1
+ module Viiite
2
+ class Formatter
3
+ class Plot < Formatter
4
+
5
+ def self.to_data(rel)
6
+ [rel.collect{|t| t[:x]}, rel.collect{|t| t[:y]}]
7
+ end
8
+
9
+ def self.to_dataset(tuple)
10
+ ds = Gnuplot::DataSet.new(to_data(tuple[:data]))
11
+ tuple.each_pair do |k,v|
12
+ next if k == :data
13
+ if ds.respond_to?(:"#{k}=")
14
+ ds.send(:"#{k}=", v)
15
+ end
16
+ end
17
+ ds
18
+ end
19
+
20
+ def self.to_plot(graph)
21
+ Gnuplot::Plot.new do |plot|
22
+ graph.each_pair do |k,v|
23
+ next if k == :series
24
+ plot.set(k.id2name, v)
25
+ end
26
+ plot.data = graph[:series].collect{|d| to_dataset(d)}
27
+ end
28
+ end
29
+
30
+ def self.to_plots(graphs, buffer = "")
31
+ graphs.each do |tuple|
32
+ buffer << to_plot(tuple).to_gplot << "\n"
33
+ end
34
+ end
35
+
36
+ end # class Plot
37
+ end # class Formatter
38
+ end # module Viiite
@@ -0,0 +1,5 @@
1
+ module Viiite
2
+ class Formatter
3
+ end # class Formatter
4
+ end # module Viiite
5
+ require 'viiite/formatter/plot'
@@ -0,0 +1,3 @@
1
+ require "alf"
2
+ require "quickl"
3
+ require "gnuplot"
@@ -0,0 +1,59 @@
1
+ module Viiite
2
+ class Runner
3
+ include Alf::Iterator
4
+
5
+ def initialize(defn)
6
+ @defn = defn
7
+ end
8
+
9
+ ### DSL
10
+
11
+ def with(hash)
12
+ if block_given?
13
+ @stack << @stack.last.merge(hash)
14
+ res = yield
15
+ @stack.pop
16
+ res
17
+ else
18
+ @stack.last.merge!(hash)
19
+ end
20
+ end
21
+
22
+ def range_over(range, name, &block)
23
+ range.each do |value|
24
+ with(name => value){ block.call(value) }
25
+ end
26
+ end
27
+
28
+ def variation_point(name, value, &proc)
29
+ h = {name => value}
30
+ with(h, &proc)
31
+ end
32
+
33
+ def report(hash = {}, &block)
34
+ hash = {:bench => hash} unless hash.is_a?(Hash)
35
+ with(hash) {
36
+ with(:tms => Viiite.measure{block.call}){ output }
37
+ }
38
+ end
39
+
40
+ ### Alf contract
41
+
42
+ def each(&reporter)
43
+ self.dup._each(&reporter)
44
+ end
45
+
46
+ protected
47
+
48
+ def _each(&reporter)
49
+ @stack, @reporter = [ {} ], reporter
50
+ self.instance_eval &@defn
51
+ @stack, @reporter = nil, nil
52
+ end
53
+
54
+ def output
55
+ @reporter.call @stack.last.dup
56
+ end
57
+
58
+ end # class Runner
59
+ end # module Viiite
data/lib/viiite/tms.rb ADDED
@@ -0,0 +1,89 @@
1
+ module Viiite
2
+ class Tms
3
+
4
+ FMTSTR = "%10.6u %10.6y %10.6t %10.6r"
5
+ FIELDS = [:utime, :stime, :cutime, :cstime, :real]
6
+
7
+ def initialize(tms)
8
+ @tms = tms
9
+ end
10
+
11
+ def self.coerce(arg)
12
+ case arg
13
+ when Viiite::Tms
14
+ arg
15
+ when Benchmark::Tms
16
+ Viiite::Tms.new arg.to_a[1..-1]
17
+ when Numeric
18
+ Viiite::Tms.new [arg, 0.0, 0.0, 0.0, 0.0]
19
+ when Hash
20
+ Viiite::Tms.new FIELDS.collect{|f| arg[f] || 0.0}
21
+ when Array
22
+ Viiite::Tms.new arg
23
+ else
24
+ raise ArgumentError, "Invalid value #{arg.inspect} for Viiite::Tms"
25
+ end
26
+ end
27
+
28
+ def utime; @tms[0]; end
29
+ def stime; @tms[1]; end
30
+ def cutime; @tms[2]; end
31
+ def cstime; @tms[3]; end
32
+ def real; @tms[4]; end
33
+ def total; cutime + cstime + stime + utime; end
34
+
35
+ def to_ruby_literal
36
+ "Viiite::Tms(#{to_a.collect{|f| f.inspect}.join(',')})"
37
+ end
38
+
39
+ def *(x); memberwise(:*, x) end
40
+ def +(other); memberwise(:+, other) end
41
+ def -(other); memberwise(:-, other) end
42
+ def /(other); memberwise(:/, other) end
43
+
44
+ def coerce(other)
45
+ [self, other]
46
+ end
47
+
48
+ def to_h
49
+ @to_h ||= Hash[FIELDS.collect{|f| [f, send(f)]}]
50
+ end
51
+
52
+ def to_a
53
+ @to_a ||= FIELDS.collect{|f| send(f)}
54
+ end
55
+
56
+ def hash
57
+ to_a.hash
58
+ end
59
+
60
+ def ==(other)
61
+ other.is_a?(Tms) && (other.to_a == self.to_a)
62
+ end
63
+ alias :eql? :==
64
+
65
+ def format(arg0 = nil, *args)
66
+ fmtstr = (arg0 || FMTSTR).dup
67
+ fmtstr.gsub!(/(%[-+\.\d]*)u/){"#{$1}f" % utime}
68
+ fmtstr.gsub!(/(%[-+\.\d]*)y/){"#{$1}f" % stime}
69
+ fmtstr.gsub!(/(%[-+\.\d]*)U/){"#{$1}f" % cutime}
70
+ fmtstr.gsub!(/(%[-+\.\d]*)Y/){"#{$1}f" % cstime}
71
+ fmtstr.gsub!(/(%[-+\.\d]*)t/){"#{$1}f" % total}
72
+ fmtstr.gsub!(/(%[-+\.\d]*)r/){"(#{$1}f)" % real}
73
+ arg0 ? Kernel::format(fmtstr, *args) : fmtstr
74
+ end
75
+ alias :to_s :format
76
+
77
+ private
78
+
79
+ def memberwise(op, x)
80
+ case x
81
+ when Viiite::Tms
82
+ Viiite::Tms.new FIELDS.collect{|f| __send__(f).__send__(op, x.send(f))}
83
+ else
84
+ Viiite::Tms.new FIELDS.collect{|f| __send__(f).__send__(op, x)}
85
+ end
86
+ end
87
+
88
+ end # class Tms
89
+ end # module Viiite
@@ -0,0 +1,14 @@
1
+ module Viiite
2
+ module Version
3
+
4
+ MAJOR = 0
5
+ MINOR = 1
6
+ TINY = 0
7
+
8
+ def self.to_s
9
+ [ MAJOR, MINOR, TINY ].join('.')
10
+ end
11
+
12
+ end
13
+ VERSION = Version.to_s
14
+ end
@@ -0,0 +1,20 @@
1
+ def viiite_clean_binding
2
+ binding
3
+ end
4
+
5
+ module Viiite
6
+ class ViiiteFile < Alf::Reader
7
+
8
+ # (see Alf::Reader#each)
9
+ def each
10
+ op = if input.is_a?(String)
11
+ Kernel.eval(input_text, viiite_clean_binding, input)
12
+ else
13
+ Kernel.eval(input_text, viiite_clean_binding)
14
+ end
15
+ op.each(&Proc.new)
16
+ end
17
+
18
+ Alf::Reader.register(:viiite, [".viiite", ".rb"], self)
19
+ end # class ViiiteFile
20
+ end # module Viiite