Commit a601ffb6a0b936880c208dc8cc24588d3ff48cda
1 parent
eca9b72d
Exists in
master
and in
5 other branches
Updated search benchmark code [skip ci]
Showing
1 changed file
with
8 additions
and
6 deletions
Show diff stats
benchmark/search.rb
... | ... | @@ -22,13 +22,15 @@ end |
22 | 22 | if ENV["SETUP"] |
23 | 23 | total_docs = 1000000 |
24 | 24 | |
25 | - ActiveRecord::Migration.create_table :products, force: :cascade do |t| | |
26 | - t.string :name | |
27 | - t.string :color | |
28 | - t.integer :store_id | |
25 | + records = [] | |
26 | + total_docs.times do |i| | |
27 | + records << { | |
28 | + name: "Product #{i}", | |
29 | + color: ["red", "blue"].sample, | |
30 | + store_id: rand(10) | |
31 | + } | |
29 | 32 | end |
30 | - | |
31 | - Product.import ["name", "color", "store_id"], total_docs.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] } | |
33 | + Product.insert_all(records) | |
32 | 34 | |
33 | 35 | puts "Imported" |
34 | 36 | ... | ... |