From eca9b72db814c8477e90d04c7566a8b73f859c03 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Thu, 21 Jan 2021 18:00:05 -0800 Subject: [PATCH] Updated benchmark code [skip ci] --- benchmark/Gemfile | 4 +--- benchmark/index.rb | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/benchmark/Gemfile b/benchmark/Gemfile index 169599d..ea8e408 100644 --- a/benchmark/Gemfile +++ b/benchmark/Gemfile @@ -1,12 +1,10 @@ source "https://rubygems.org" -# Specify your gem's dependencies in searchkick.gemspec gemspec path: "../" gem "sqlite3" gem "pg" -gem "activerecord", "~> 5.1.0" -gem "activerecord-import" +gem "activerecord", "~> 6.1.0" gem "activejob" gem "redis" gem "sidekiq" diff --git a/benchmark/index.rb b/benchmark/index.rb index a7af88a..a3492e6 100644 --- a/benchmark/index.rb +++ b/benchmark/index.rb @@ -1,6 +1,7 @@ require "bundler/setup" Bundler.require(:default) require "active_record" +require "active_job" require "benchmark" require "active_support/notifications" @@ -42,7 +43,15 @@ if ENV["SETUP"] t.integer :store_id end - Product.import ["name", "color", "store_id"], total_docs.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] } + records = [] + total_docs.times do |i| + records << { + name: "Product #{i}", + color: ["red", "blue"].sample, + store_id: rand(10) + } + end + Product.insert_all(records) puts "Imported" end -- libgit2 0.21.0