rubybench_runner 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +7 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +44 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +43 -0
  9. data/Rakefile +12 -0
  10. data/bin/console +15 -0
  11. data/bin/setup +8 -0
  12. data/exe/rubybench_runner +101 -0
  13. data/lib/rubybench_runner.rb +17 -0
  14. data/lib/rubybench_runner/base_runner.rb +233 -0
  15. data/lib/rubybench_runner/configurations.rb +68 -0
  16. data/lib/rubybench_runner/dependencies_checker.rb +39 -0
  17. data/lib/rubybench_runner/helpers_version +1 -0
  18. data/lib/rubybench_runner/rails/.bundle/config +4 -0
  19. data/lib/rubybench_runner/rails/benchmarks/assets/javascripts/application.js +3 -0
  20. data/lib/rubybench_runner/rails/benchmarks/assets/javascripts/one.js.erb +5 -0
  21. data/lib/rubybench_runner/rails/benchmarks/assets/javascripts/two.js +1 -0
  22. data/lib/rubybench_runner/rails/benchmarks/form_partials/first.html.erb +17 -0
  23. data/lib/rubybench_runner/rails/benchmarks/form_partials/heavy/_item.html.erb +12 -0
  24. data/lib/rubybench_runner/rails/benchmarks/form_partials/heavy/_second.html.erb +7 -0
  25. data/lib/rubybench_runner/rails/benchmarks/form_partials/heavy/_third.html.erb +8 -0
  26. data/lib/rubybench_runner/rails/benchmarks/form_partials/layouts/application.html.erb +29 -0
  27. data/lib/rubybench_runner/rails/benchmarks/partials/first.html.erb +19 -0
  28. data/lib/rubybench_runner/rails/benchmarks/partials/heavy/_item.html.erb +0 -0
  29. data/lib/rubybench_runner/rails/benchmarks/partials/heavy/_second.html.erb +7 -0
  30. data/lib/rubybench_runner/rails/benchmarks/partials/heavy/_third.html.erb +3 -0
  31. data/lib/rubybench_runner/rails/benchmarks/partials/layouts/application.html.erb +29 -0
  32. data/lib/rubybench_runner/rails/benchmarks/support/benchmark_rails.rb +14 -0
  33. data/lib/rubybench_runner/rails/benchmarks/support/echo_channel.rb +13 -0
  34. data/lib/rubybench_runner/rails/benchmarks/support/request_helper.rb +9 -0
  35. data/lib/rubybench_runner/rails/benchmarks/support/url_generation_base.rb +79 -0
  36. data/lib/rubybench_runner/rails/benchmarks/views/posts/_form.html.erb +29 -0
  37. data/lib/rubybench_runner/rails/benchmarks/views/posts/edit.html.erb +6 -0
  38. data/lib/rubybench_runner/rails/benchmarks/views/posts/index.html.erb +32 -0
  39. data/lib/rubybench_runner/rails/benchmarks/views/posts/index.json.jbuilder +4 -0
  40. data/lib/rubybench_runner/rails/benchmarks/views/posts/new.html.erb +5 -0
  41. data/lib/rubybench_runner/rails/benchmarks/views/posts/show.html.erb +19 -0
  42. data/lib/rubybench_runner/rails/benchmarks/views/posts/show.json.jbuilder +1 -0
  43. data/lib/rubybench_runner/rails_runner.rb +91 -0
  44. data/lib/rubybench_runner/support/benchmark_runner.rb +62 -0
  45. data/lib/rubybench_runner/support/helpers.rb +11 -0
  46. data/lib/rubybench_runner/support/setup/.bundle/config +4 -0
  47. data/lib/rubybench_runner/support/setup/Gemfile +11 -0
  48. data/lib/rubybench_runner/support/setup/bm_create_string_columns_setup.rb +16 -0
  49. data/lib/rubybench_runner/support/setup/bm_destroy_setup.rb +12 -0
  50. data/lib/rubybench_runner/support/setup/bm_discourse_setup.rb +164 -0
  51. data/lib/rubybench_runner/support/setup/bm_finders_setup.rb +37 -0
  52. data/lib/rubybench_runner/support/setup/bm_preload_setup.rb +41 -0
  53. data/lib/rubybench_runner/support/setup/bm_save_setup.rb +12 -0
  54. data/lib/rubybench_runner/support/setup/bm_scope_all_setup.rb +32 -0
  55. data/lib/rubybench_runner/support/setup/bm_scope_where_setup.rb +30 -0
  56. data/lib/rubybench_runner/support/setup/bm_validations_invalid_setup.rb +18 -0
  57. data/lib/rubybench_runner/support/setup/bm_validations_valid_setup.rb +30 -0
  58. data/lib/rubybench_runner/support/setup/bm_with_default_scope_setup.rb +29 -0
  59. data/lib/rubybench_runner/version.rb +5 -0
  60. data/rubybench_runner.gemspec +34 -0
  61. metadata +200 -0
@@ -0,0 +1,41 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+ ActiveRecord::Migration.verbose = false
6
+
7
+ ActiveRecord::Schema.define do
8
+ create_table :users, force: true do |t|
9
+ t.string :name, :email
10
+ t.integer :topic_id
11
+ t.timestamps null: false
12
+ end
13
+
14
+ create_table :topics, force: true do |t|
15
+ t.string :title
16
+ t.timestamps null: false
17
+ end
18
+ end
19
+
20
+ attributes = {
21
+ name: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
22
+ email: 'foobar@email.com'
23
+ }
24
+
25
+ class Topic < ActiveRecord::Base
26
+ has_many :users
27
+ end
28
+
29
+ class User < ActiveRecord::Base
30
+ belongs_to :topic
31
+ end
32
+
33
+ 100.times do
34
+ User.create!(attributes)
35
+ end
36
+
37
+ users = User.first(50)
38
+
39
+ 100.times do
40
+ Topic.create!(title: 'This is a topic', users: users)
41
+ end
@@ -0,0 +1,12 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+ ActiveRecord::Migration.verbose = false
6
+
7
+ ActiveRecord::Schema.define do
8
+ create_table :users, force: true do |t|
9
+ t.string :name, :email
10
+ t.timestamps null: false
11
+ end
12
+ end
@@ -0,0 +1,32 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+
6
+ ActiveRecord::Migration.verbose = false
7
+
8
+ ActiveRecord::Schema.define do
9
+ create_table :users, force: true do |t|
10
+ t.string :name
11
+ t.string :email
12
+ t.boolean :approved
13
+ t.integer :age
14
+ t.datetime :birthday
15
+ t.timestamps null: false
16
+ end
17
+ end
18
+
19
+ class User < ActiveRecord::Base; end
20
+
21
+ attributes = {
22
+ name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
23
+ email: "foobar@email.com",
24
+ approved: false,
25
+ age: 51,
26
+ birthday: DateTime.now
27
+ }
28
+
29
+ 1000.times do
30
+ User.create!(attributes)
31
+ end
32
+
@@ -0,0 +1,30 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+ ActiveRecord::Migration.verbose = false
6
+
7
+ ActiveRecord::Schema.define do
8
+ create_table :users, force: true do |t|
9
+ t.string :name
10
+ t.string :email
11
+ t.boolean :approved
12
+ t.integer :age
13
+ t.datetime :birthday
14
+ t.timestamps null: false
15
+ end
16
+
17
+ add_index :users, :email, unique: true
18
+ end
19
+
20
+ class User < ActiveRecord::Base; end
21
+
22
+ 1000.times do |i|
23
+ User.create!({
24
+ name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
25
+ email: "foobar#{"%03d" % i}@email.com",
26
+ approved: false,
27
+ age: 51,
28
+ birthday: DateTime.now
29
+ })
30
+ end
@@ -0,0 +1,18 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+ ActiveRecord::Migration.verbose = false
6
+
7
+ ActiveRecord::Schema.define do
8
+ create_table :posts, force: true do |t|
9
+ t.string :title
10
+ t.string :author
11
+ t.text :body
12
+ t.integer :sequence
13
+ t.integer :age
14
+ t.string :subdomain
15
+ t.string :legacy_code
16
+ t.string :size
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+ ActiveRecord::Migration.verbose = false
6
+
7
+ ActiveRecord::Schema.define do
8
+ create_table :posts, force: true do |t|
9
+ t.string :title
10
+ t.string :author
11
+ t.text :body
12
+ t.integer :sequence
13
+ t.integer :age
14
+ t.string :subdomain
15
+ t.string :legacy_code
16
+ t.string :size
17
+ end
18
+ end
19
+
20
+ class Post < ActiveRecord::Base; end
21
+
22
+ Post.create!({
23
+ title: 'RubyBench',
24
+ author: 'RubyBench',
25
+ age: 21,
26
+ sequence: 90,
27
+ subdomain: 'ru',
28
+ legacy_code: 'letters',
29
+ size: 'small'
30
+ })
@@ -0,0 +1,29 @@
1
+ require "bundler/setup"
2
+ require "active_record"
3
+
4
+ ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
5
+ ActiveRecord::Migration.verbose = false
6
+
7
+ ActiveRecord::Schema.define do
8
+ create_table :users, force: true do |t|
9
+ t.string :name
10
+ t.string :email
11
+ t.boolean :approved
12
+ t.integer :age
13
+ t.datetime :birthday
14
+ t.boolean :admin
15
+ t.timestamps null: false
16
+ end
17
+ end
18
+
19
+ class User < ActiveRecord::Base; end
20
+
21
+ attributes = {
22
+ name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
23
+ email: "foobar@email.com",
24
+ approved: false,
25
+ age: 51
26
+ }
27
+
28
+ 500.times { User.create!(attributes.merge(admin: true)) }
29
+ 500.times { User.create!(attributes.merge(admin: false)) }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubybenchRunner
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'rubybench_runner/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'rubybench_runner'
9
+ spec.version = RubybenchRunner::VERSION
10
+
11
+ spec.summary = 'Gem to run rubybench.org benchmarks locally'
12
+ spec.homepage = 'https://github.com/ruby-bench/rubybench_runner'
13
+ spec.license = 'MIT'
14
+ spec.authors = ['Osama Sayegh']
15
+
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`
18
+ .split("\x0")
19
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_development_dependency 'bundler', '~> 2.0'
27
+ spec.add_development_dependency 'pg', '1.1.4'
28
+ spec.add_development_dependency 'mysql2', '0.5.2'
29
+
30
+ spec.add_development_dependency 'byebug'
31
+ spec.add_development_dependency 'minitest', '~> 5.0'
32
+ spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'rubocop', '~> 0.70'
34
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubybench_runner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Osama Sayegh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pg
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.4
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.1.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: mysql2
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.70'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.70'
111
+ description:
112
+ email:
113
+ executables:
114
+ - rubybench_runner
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".travis.yml"
120
+ - CODE_OF_CONDUCT.md
121
+ - Gemfile
122
+ - Gemfile.lock
123
+ - LICENSE.txt
124
+ - README.md
125
+ - Rakefile
126
+ - bin/console
127
+ - bin/setup
128
+ - exe/rubybench_runner
129
+ - lib/rubybench_runner.rb
130
+ - lib/rubybench_runner/base_runner.rb
131
+ - lib/rubybench_runner/configurations.rb
132
+ - lib/rubybench_runner/dependencies_checker.rb
133
+ - lib/rubybench_runner/helpers_version
134
+ - lib/rubybench_runner/rails/.bundle/config
135
+ - lib/rubybench_runner/rails/benchmarks/assets/javascripts/application.js
136
+ - lib/rubybench_runner/rails/benchmarks/assets/javascripts/one.js.erb
137
+ - lib/rubybench_runner/rails/benchmarks/assets/javascripts/two.js
138
+ - lib/rubybench_runner/rails/benchmarks/form_partials/first.html.erb
139
+ - lib/rubybench_runner/rails/benchmarks/form_partials/heavy/_item.html.erb
140
+ - lib/rubybench_runner/rails/benchmarks/form_partials/heavy/_second.html.erb
141
+ - lib/rubybench_runner/rails/benchmarks/form_partials/heavy/_third.html.erb
142
+ - lib/rubybench_runner/rails/benchmarks/form_partials/layouts/application.html.erb
143
+ - lib/rubybench_runner/rails/benchmarks/partials/first.html.erb
144
+ - lib/rubybench_runner/rails/benchmarks/partials/heavy/_item.html.erb
145
+ - lib/rubybench_runner/rails/benchmarks/partials/heavy/_second.html.erb
146
+ - lib/rubybench_runner/rails/benchmarks/partials/heavy/_third.html.erb
147
+ - lib/rubybench_runner/rails/benchmarks/partials/layouts/application.html.erb
148
+ - lib/rubybench_runner/rails/benchmarks/support/benchmark_rails.rb
149
+ - lib/rubybench_runner/rails/benchmarks/support/echo_channel.rb
150
+ - lib/rubybench_runner/rails/benchmarks/support/request_helper.rb
151
+ - lib/rubybench_runner/rails/benchmarks/support/url_generation_base.rb
152
+ - lib/rubybench_runner/rails/benchmarks/views/posts/_form.html.erb
153
+ - lib/rubybench_runner/rails/benchmarks/views/posts/edit.html.erb
154
+ - lib/rubybench_runner/rails/benchmarks/views/posts/index.html.erb
155
+ - lib/rubybench_runner/rails/benchmarks/views/posts/index.json.jbuilder
156
+ - lib/rubybench_runner/rails/benchmarks/views/posts/new.html.erb
157
+ - lib/rubybench_runner/rails/benchmarks/views/posts/show.html.erb
158
+ - lib/rubybench_runner/rails/benchmarks/views/posts/show.json.jbuilder
159
+ - lib/rubybench_runner/rails_runner.rb
160
+ - lib/rubybench_runner/support/benchmark_runner.rb
161
+ - lib/rubybench_runner/support/helpers.rb
162
+ - lib/rubybench_runner/support/setup/.bundle/config
163
+ - lib/rubybench_runner/support/setup/Gemfile
164
+ - lib/rubybench_runner/support/setup/bm_create_string_columns_setup.rb
165
+ - lib/rubybench_runner/support/setup/bm_destroy_setup.rb
166
+ - lib/rubybench_runner/support/setup/bm_discourse_setup.rb
167
+ - lib/rubybench_runner/support/setup/bm_finders_setup.rb
168
+ - lib/rubybench_runner/support/setup/bm_preload_setup.rb
169
+ - lib/rubybench_runner/support/setup/bm_save_setup.rb
170
+ - lib/rubybench_runner/support/setup/bm_scope_all_setup.rb
171
+ - lib/rubybench_runner/support/setup/bm_scope_where_setup.rb
172
+ - lib/rubybench_runner/support/setup/bm_validations_invalid_setup.rb
173
+ - lib/rubybench_runner/support/setup/bm_validations_valid_setup.rb
174
+ - lib/rubybench_runner/support/setup/bm_with_default_scope_setup.rb
175
+ - lib/rubybench_runner/version.rb
176
+ - rubybench_runner.gemspec
177
+ homepage: https://github.com/ruby-bench/rubybench_runner
178
+ licenses:
179
+ - MIT
180
+ metadata: {}
181
+ post_install_message:
182
+ rdoc_options: []
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ requirements: []
196
+ rubygems_version: 3.0.3
197
+ signing_key:
198
+ specification_version: 4
199
+ summary: Gem to run rubybench.org benchmarks locally
200
+ test_files: []