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.`
This commit is contained in:
Alan Guo Xiang Tan 2024-02-19 11:33:52 +08:00 committed by GitHub
parent fc9648578b
commit bdd91b3928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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