diff --git a/benchmarks/shipit/benchmark.rb b/benchmarks/shipit/benchmark.rb index 54e51dfa..3787cc03 100644 --- a/benchmarks/shipit/benchmark.rb +++ b/benchmarks/shipit/benchmark.rb @@ -14,6 +14,15 @@ require_relative 'config/environment' require_relative "route_generator" +# Precompile assets once so that Sprockets never shells out to Node.js during +# warmup/benchmark iterations (shipit-engine ships CoffeeScript assets). +unless Dir.glob(File.join(__dir__, 'public/assets/.sprockets-manifest*.json')).any? + puts "Precompiling assets..." + Rails.application.load_tasks + Rake::Task['assets:precompile'].invoke + puts "Assets precompiled." +end + # For an in-mem DB, we need to load all data on every boot mem_db = ActiveRecord::Base.connection.raw_connection file_db = SQLite3::Database.new('db/production.committed.sqlite3')