Skip to content

Commit

Permalink
Updated benchmark scripts [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Dec 18, 2024
1 parent dd63a30 commit 2bf4245
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 4 additions & 2 deletions benchmark/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ gemspec path: "../"

gem "sqlite3"
gem "pg"
gem "activerecord", "~> 6.1.0"
gem "activerecord", "~> 8.0.0"
gem "activejob"
gem "elasticsearch"
gem "redis"
gem "sidekiq"

# performance
gem "typhoeus"
gem "oj"
# gem "json", "2.9.1"

# profiling
gem "ruby-prof"
gem "allocation_stats"
gem "get_process_mem"
gem "memory_profiler"
gem "allocation_tracer"
# gem "allocation_tracer"
gem "benchmark-ips"
2 changes: 1 addition & 1 deletion benchmark/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

Searchkick.redis = Redis.new

ActiveRecord::Base.default_timezone = :utc
ActiveRecord.default_timezone = :utc
ActiveRecord::Base.time_zone_aware_attributes = true
# ActiveRecord::Base.establish_connection adapter: "sqlite3", database: "/tmp/searchkick"
ActiveRecord::Base.establish_connection "postgresql://localhost/searchkick_demo_development"
Expand Down
6 changes: 2 additions & 4 deletions benchmark/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "active_record"
require "benchmark/ips"

ActiveRecord::Base.default_timezone = :utc
ActiveRecord.default_timezone = :utc
ActiveRecord::Base.time_zone_aware_attributes = true
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: "/tmp/searchkick"

Expand Down Expand Up @@ -46,11 +46,9 @@ def search_data
end

query = Product.search("product", fields: [:name], where: {color: "red", store_id: 5}, limit: 10000, load: false)

require "pp"
pp query.body.as_json
puts

Benchmark.ips do |x|
x.report { query.dup.execute }
x.report { query.dup.load }
end

0 comments on commit 2bf4245

Please sign in to comment.