From bdd91b39288216095ff7915a4428aa719597e887 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Mon, 19 Feb 2024 11:33:52 +0800 Subject: [PATCH] PERF: Stop running bootsnap in development mode on all environments (#25737) Why this change? For some reason, we were setting up bootsnap manually even though the official documentation suggests requiring `bootsnap/setup` which will setup bootsnap using the default configuration. Because we were calling `Bootsnap.setup` manually, we did not set the `development_mode` option which defaults to `true`. Hence, we were running bootsnap in development mode even in the production environment which I suppose is not ideal. What does this change do? Instead of calling `Bootsnap.setup` manually, we can just use `require 'bootsnap/setup' instead.` --- config/boot.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/config/boot.rb b/config/boot.rb index bf5d61d56d6..d8552b2ffb2 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -14,19 +14,10 @@ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) if (ENV["DISABLE_BOOTSNAP"] != "1") begin - require "bootsnap" + require "bootsnap/setup" rescue LoadError # not a strong requirement end - - if defined?(Bootsnap) - Bootsnap.setup( - cache_dir: "tmp/cache", # Path to your cache - load_path_cache: true, # Should we optimize the LOAD_PATH with a cache? - compile_cache_iseq: true, # Should compile Ruby code into ISeq cache? - compile_cache_yaml: false, # Skip YAML cache for now, cause we were seeing issues with it - ) - end end # Parallel spec system