Skip to content

Commit

Permalink
(puppetlabsGH-2291) Enable Bootsnap
Browse files Browse the repository at this point in the history
This enables Bootsnap's compile cache for Bolt when running on Windows, which caches the compiled Ruby bytecode and YAML Messagepack format results for faster loading. When using Bootsnap we disable the load path cache, since Bolt modifies the load path from the user's environment which results in the cache being recomputed and rewritten every Bolt run, which negates any performance improvements from compilation caching.

!no-release-note
  • Loading branch information
lucywyman committed Sep 13, 2021
1 parent 6a4b62b commit b3b9d02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions bolt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Gem::Specification.new do |spec|

spec.add_dependency "addressable", '~> 2.5'
spec.add_dependency "aws-sdk-ec2", '~> 1'
spec.add_dependency "bootsnap", '~> 1.7'
spec.add_dependency "CFPropertyList", "~> 2.2"
spec.add_dependency "concurrent-ruby", "~> 1.0"
spec.add_dependency "ffi", ">= 1.9.25", "< 2.0.0"
Expand Down
7 changes: 7 additions & 0 deletions exe/bolt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
require 'bootsnap'
Bootsnap.setup(
cache_dir: File.join(ENV['ProgramData'], 'PuppetLabs', 'bolt'),
load_path_cache: false
)
end
require 'bolt'
require 'bolt/cli'

Expand Down

0 comments on commit b3b9d02

Please sign in to comment.