discourse/script/boot_mem.rb
Jarek Radosz fbb3bf3fe8
DEV: Enable Style/RedundantBegin rubocop rule (#40096)
(to be enabled in the shared config)

best reviewed with whitespace disabled
2026-05-19 18:44:54 +02:00

29 lines
706 B
Ruby
Vendored

# frozen_string_literal: true
# simple script to measure memory at boot
exec "RAILS_ENV=production ruby #{__FILE__}" if ENV["RAILS_ENV"] != "production"
require "memory_profiler"
MemoryProfiler
.report do
require File.expand_path("../../config/environment", __FILE__)
begin
Rails.application.routes.recognize_path("abc")
rescue StandardError
nil
end
# load up the yaml for the localization bits, in master process
I18n.t(:posts)
# load up all models and schema
(ActiveRecord::Base.connection.tables - %w[schema_migrations versions]).each do |table|
table.classify.constantize.first
rescue StandardError
nil
end
end
.pretty_print