forked from Homebrew/brew
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HOMEBREW_BOOTSNAP to optionally use Bootsnap
> Bootsnap is a library that plugs into Ruby, with optional support > for ActiveSupport and YAML, to optimize and cache expensive > computations. https://github.com/Shopify/bootsnap For our case that translates to "repeated calls to `brew` have reductions in the time spend `require`ing speeding up the process boot time". For example: ``` $ hyperfine --warmup=2 "unset HOMEBREW_BOOTSNAP; brew info wget" "export HOMEBREW_BOOTSNAP=1; brew info wget" Benchmark #1: unset HOMEBREW_BOOTSNAP; brew info wget Time (mean ± σ): 2.417 s ± 0.032 s [User: 659.0 ms, System: 855.5 ms] Range (min … max): 2.382 s … 2.464 s 10 runs Benchmark #2: export HOMEBREW_BOOTSNAP=1; brew info wget Time (mean ± σ): 1.862 s ± 0.064 s [User: 425.3 ms, System: 566.8 ms] Range (min … max): 1.736 s … 1.952 s 10 runs Summary 'export HOMEBREW_BOOTSNAP=1; brew info wget' ran 1.30 ± 0.05 times faster than 'unset HOMEBREW_BOOTSNAP; brew info wget' ```
- Loading branch information
1 parent
c7e9fdc
commit 683ae7f
Showing
6 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# typed: ignore | ||
# frozen_string_literal: true | ||
|
||
# TODO: make this `typed: true` when HOMEBREW_BOOTSNAP is enabled by | ||
# default and/or we vendor bootsnap and the RBI file. | ||
|
||
raise "Needs HOMEBREW_BOOTSNAP!" unless ENV["HOMEBREW_BOOTSNAP"] | ||
|
||
require "rubygems" | ||
require "bootsnap" | ||
|
||
Bootsnap.setup( | ||
cache_dir: "#{ENV["HOMEBREW_TEMP"]}/homebrew-bootsnap", | ||
development_mode: false, # TODO: use ENV["HOMEBREW_DEVELOPER"]?, | ||
load_path_cache: true, | ||
autoload_paths_cache: true, | ||
disable_trace: true, | ||
compile_cache_iseq: true, | ||
compile_cache_yaml: true, | ||
) |
This file contains 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
This file contains 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