Last active
September 24, 2025 01:42
-
-
Save soberstadt/8b366555a9d7057b8808803f0c5e8032 to your computer and use it in GitHub Desktop.
Rails boot profiling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'stackprof' | |
| end | |
| profile = StackProf.run(raw: true) do | |
| require_relative "config/environment" | |
| ActiveRecord::Base.connection.verify! | |
| end | |
| File.write('tmp/stackprof.json', JSON.generate(profile)) | |
| # open tmp/stackprof.json in https://www.speedscope.app/ |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save this file in the root of your rails app. Run it with
ruby boot_profile.rb.