DEV: Fix benchmark script

Following a recent commit (cb4b8146a3),
the benchmark script wasn’t working anymore (and the related rake task).

This patch fixes it. It also adds some information about Ruby YJIT being
enabled or not.
This commit is contained in:
Loïc Guitaut 2024-11-14 16:42:17 +01:00 committed by Loïc Guitaut
parent 5563e9dc03
commit 581fb97bfa
2 changed files with 12 additions and 11 deletions

View File

@ -13,15 +13,15 @@ task "user_api_key:create", [:username] => :environment do |task, args|
application_name = "perf test application" application_name = "perf test application"
user_api_key = UserApiKey.where(application_name: application_name).destroy_all UserApiKeyClient.where(application_name: application_name).destroy_all
user_api_key = UserApiKeyClient
UserApiKey.create!( .create!(client_id: "1234", application_name:)
application_name: application_name, .then do |client|
client_id: "1234", client.keys.create!(
scopes: ["read"].map { |name| UserApiKeyScope.new(name: name) }, scopes: ["read"].map { |name| UserApiKeyScope.new(name:) },
user_id: user.id, user_id: user.id,
) )
end
puts user_api_key.key .then { |user_api_key| puts user_api_key.key }
end end

View File

@ -168,7 +168,7 @@ puts `bundle exec rake db:create`
`bundle exec rake db:migrate` `bundle exec rake db:migrate`
puts "Timing loading Rails" puts "Timing loading Rails"
measure("load_rails") { `bundle exec rake middleware` } measure("load_rails") { `bundle exec rails middleware` }
puts "Populating Profile DB" puts "Populating Profile DB"
run("bundle exec ruby script/profile_db_generator.rb") run("bundle exec ruby script/profile_db_generator.rb")
@ -320,6 +320,7 @@ begin
results.merge( results.merge(
"timings" => @timings, "timings" => @timings,
"ruby-version" => "#{RUBY_DESCRIPTION}", "ruby-version" => "#{RUBY_DESCRIPTION}",
"yjit" => RubyVM::YJIT.enabled?,
"rss_kb" => mem["rss_kb"], "rss_kb" => mem["rss_kb"],
"pss_kb" => mem["pss_kb"], "pss_kb" => mem["pss_kb"],
).merge(facts) ).merge(facts)