diff --git a/.rubocop.yml b/.rubocop.yml index a83a45b4..27146e27 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -239,5 +239,8 @@ Lint/EmptyWhen: Style/FormatStringToken: EnforcedStyle: unannotated +Bundler/OrderedGems: + Enabled: false + Layout/EmptyLineAfterGuardClause: Enabled: false diff --git a/ChangeLog.md b/ChangeLog.md index 5c4869d0..bdaeeb5d 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,15 @@ 更新履歴 - ChangeLog ==================== +3.3.1: 2018/xx/xx +------------------ +#### 追加機能 +- 起動速度を向上させる Bootsnap を利用できるようにしました + - gem install bootsnap を実行し、環境変数 NAROU_ENABLE_BOOTSNAP に真を設定 + すると有効になります。(※Bootsnap は Windows では動作しません) + - 約20%くらい起動速度が速くなります + + 3.3.0: 2018/xx/xx ------------------ #### 追加機能 diff --git a/Gemfile b/Gemfile index 93d3ce85..86775b71 100644 --- a/Gemfile +++ b/Gemfile @@ -16,3 +16,4 @@ gem "better_errors" gem "binding_of_caller" gem "awesome_print" gem "simplecov", require: false, group: :test +gem "bootsnap", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 4b026714..08c6337b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,9 +35,14 @@ GEM rack (>= 0.9.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) + bootsnap (1.3.2) + msgpack (~> 1.0) + bootsnap (1.3.2-java) + msgpack (~> 1.0) byebug (10.0.2) coderay (1.1.2) concurrent-ruby (1.0.5) + concurrent-ruby (1.0.5-java) debug_inspector (0.0.3) diff-lcs (1.3) docile (1.3.1) @@ -59,6 +64,8 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2018.0812) minitest (5.11.3) + msgpack (1.2.4) + msgpack (1.2.4-java) multi_json (1.13.1) open_uri_redirections (0.2.1) pony (1.12) @@ -125,6 +132,7 @@ GEM systemu (2.6.5) termcolorlight (1.1.1) thread_safe (0.3.6) + thread_safe (0.3.6-java) tilt (2.0.8) timecop (0.9.1) tzinfo (1.2.5) @@ -139,6 +147,7 @@ DEPENDENCIES awesome_print better_errors binding_of_caller + bootsnap narou! pry pry-byebug diff --git a/config/bootsnap_setup.rb b/config/bootsnap_setup.rb new file mode 100644 index 00000000..4f19994b --- /dev/null +++ b/config/bootsnap_setup.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +if ENV["NAROU_ENABLE_BOOTSNAP"] + require "bootsnap" + Bootsnap.setup( + cache_dir: "tmp/cache", + development_mode: false, + load_path_cache: true, + autoload_paths_cache: false, + disable_trace: false, + compile_cache_iseq: true, + compile_cache_yaml: true + ) +end diff --git a/narou.gemspec b/narou.gemspec index ad87823c..af671dc5 100644 --- a/narou.gemspec +++ b/narou.gemspec @@ -109,4 +109,3 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'activesupport', '~> 5.2' gem.add_runtime_dependency 'unicode-display_width', '~> 1.4' end - diff --git a/narou.rb b/narou.rb index 87da4c13..53e4b95a 100644 --- a/narou.rb +++ b/narou.rb @@ -7,6 +7,8 @@ # Copyright 2013 whiteleaf. All rights reserved. # +require_relative "config/bootsnap_setup" + require_relative "lib/extension" require_relative "lib/extensions/monkey_patches" require_relative "lib/backtracer"