From 56b3601063c9563c9f8db95507fa90fd15cf0422 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 18 Mar 2021 17:22:59 +0100 Subject: [PATCH] app: enable Bootsnap Bootsnap speeds up the initial loading of the Rails app by: - Optimizing the LOAD_PATH dynamically - Caching the result of Ruby bytecode compilation Cached data are written to `tmp/cache/bootsnap*`. This is enabled in the default Rails app template. --- Gemfile | 1 + Gemfile.lock | 4 ++++ config/boot.rb | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 14898ae50..8be7243c8 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,7 @@ gem 'administrate' gem 'after_party' gem 'anchored' gem 'bcrypt' +gem 'bootsnap', '>= 1.4.4', require: false # Reduces boot times through caching; required in config/boot.rb gem 'browser' gem 'chartkick' gem 'chunky_png' diff --git a/Gemfile.lock b/Gemfile.lock index 74145f600..03737005a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -134,6 +134,8 @@ GEM bcrypt (3.1.16) bindata (2.4.8) bindex (0.8.1) + bootsnap (1.7.2) + msgpack (~> 1.0) brakeman (5.0.0) browser (5.3.0) builder (3.2.4) @@ -419,6 +421,7 @@ GEM minitest (5.14.4) momentjs-rails (2.20.1) railties (>= 3.1) + msgpack (1.4.2) multi_json (1.15.0) multipart-post (2.1.1) mustermann (1.1.1) @@ -781,6 +784,7 @@ DEPENDENCIES annotate axe-matchers bcrypt + bootsnap (>= 1.4.4) brakeman browser capybara diff --git a/config/boot.rb b/config/boot.rb index 30f5120df..3cda23b4d 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' # Set up gems listed in the Gemfile. +require "bundler/setup" # Set up gems listed in the Gemfile. +require "bootsnap/setup" # Speed up boot time by caching expensive operations.