rubybenchmark 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Kornelius Kalnbach
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ = rubybenchmark
2
+
3
+ This gem performs a simple benchmark to test Ruby performance on your machine.
4
+
5
+ It originated in a thread on the German Ruby forum: http://forum.ruby-portal.de/viewtopic.php?t=11893
6
+
7
+ == Running the benchmark
8
+
9
+ is simple:
10
+
11
+ rubybenchmark
12
+
13
+ == Copyright
14
+
15
+ Copyright (c) 2010 Kornelius Kalnbach. See LICENSE for details.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'ruby_benchmark'
3
+ RubyBenchmark.perform
@@ -0,0 +1,30 @@
1
+ require 'benchmark'
2
+
3
+ # Performs some Ruby benchmarks to calculate the Ruby benchmark index.
4
+ module RubyBenchmark
5
+ class << self
6
+
7
+ # Call this method to start the Benchmark.
8
+ def perform
9
+ puts 'Benchmark is running, please wait...'
10
+ time = Benchmark.realtime { all_benchmarks }
11
+ puts "-> Your machine scored #{calculate_index(time)} points on the Ruby benchmark [v0.1]."
12
+ end
13
+
14
+ protected
15
+
16
+ def calculate_index time # :nodoc:
17
+ (1_000 / time).round
18
+ end
19
+
20
+ def all_benchmarks # :nodoc:
21
+ string_concat_fixnum_to_s
22
+ end
23
+
24
+ def string_concat_fixnum_to_s # :nodoc:
25
+ string = ''
26
+ 50_000.times { |i| string += i.to_s }
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'ruby_benchmark'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,8 @@
1
+ require 'helper'
2
+
3
+ class TestRubyBenchmark < Test::Unit::TestCase
4
+ should "perform benchmark" do
5
+ # lambda { RubyBenchmark.perform }.should_not raise_error
6
+ RubyBenchmark.perform
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubybenchmark
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Kornelius Kalnbach
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-11 00:00:00 +13:00
19
+ default_executable: rubybenchmark
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: thoughtbot-shoulda
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: This gem performs a simple benchmark to test Ruby performance on your machine.
36
+ email: murphy@rubychan.de
37
+ executables:
38
+ - rubybenchmark
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - bin/rubybenchmark
46
+ - lib/ruby_benchmark.rb
47
+ - LICENSE
48
+ - README.rdoc
49
+ - test/helper.rb
50
+ - test/test_ruby_benchmark.rb
51
+ has_rdoc: true
52
+ homepage: http://github.com/rubychan/rubybenchmark
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --charset=UTF-8
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.3.7
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Ruby benchmark. Just run "rubybenchmark".
85
+ test_files:
86
+ - test/helper.rb
87
+ - test/test_ruby_benchmark.rb