Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bootsnap to optimize boot time. #7082

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@hanachin
Copy link

commented May 24, 2019

before

    _╰╰,   /バショ % ~/src/github.com/rubocop-hq/rubocop
  _/o ŏァ  / ブランチ% master ヤバイ
∈ミ;ノ,ノ   \メイレイ% time bundle exec rubocop -v
0.70.0
bundle exec rubocop -v  0.79s user 0.12s system 95% cpu 0.952 total
    _╰╰,   /バショ % ~/src/github.com/rubocop-hq/rubocop
  _/o ŏァ  / ブランチ% master ヤバイ
∈ミ;ノ,ノ   \メイレイ% time bundle exec rubocop -v
0.70.0
bundle exec rubocop -v  0.75s user 0.06s system 97% cpu 0.832 total
    _╰╰,   /バショ % ~/src/github.com/rubocop-hq/rubocop
  _/o ŏァ  / ブランチ% master ヤバイ
∈ミ;ノ,ノ   \メイレイ% time bundle exec rubocop -v
0.70.0
bundle exec rubocop -v  0.78s user 0.10s system 95% cpu 0.923 tota

after

    _╰╰,   /バショ % ~/src/github.com/rubocop-hq/rubocop
  _/o ŏァ  / ブランチ% master● ヤバイ
∈ミ;ノ,ノ   \メイレイ% time bundle exec rubocop -v
0.70.0
bundle exec rubocop -v  0.52s user 0.08s system 95% cpu 0.634 total
    _╰╰,   /バショ % ~/src/github.com/rubocop-hq/rubocop
  _/o ŏァ  / ブランチ% master● ヤバイ
∈ミ;ノ,ノ   \メイレイ% time bundle exec rubocop -v
0.70.0
bundle exec rubocop -v  0.55s user 0.10s system 93% cpu 0.689 total
    _╰╰,   /バショ % ~/src/github.com/rubocop-hq/rubocop
  _/o ŏァ  / ブランチ% master● ヤバイ
∈ミ;ノ,ノ   \メイレイ% time bundle exec rubocop -v
0.70.0
bundle exec rubocop -v  0.58s user 0.08s system 93% cpu 0

Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.
@bbatsov

This comment has been minimized.

Copy link
Collaborator

commented May 28, 2019

I'm not familiar with bootsnap, so I can't really comment on this. Any thoughts @rubocop-hq/rubocop-core?

@bquorning
Copy link
Member

left a comment

I think Bootsnap is an amazing tool, but I believe it should only be used as part of your application (or system).

It should not be a required dependency of RuboCop (or libraries in general).

@hanachin

This comment has been minimized.

Copy link
Author

commented May 29, 2019

It should not be a required dependency of RuboCop (or libraries in general).

I got it, thanks.
I can use my binstub like following instead of adding dependency to rubocop.

#!/usr/bin/env ruby
require 'bootsnap'
cache_dir = File.join(ENV['HOME'], '.cache', 'rubocop_bootsnap_cache')
Bootsnap.setup(cache_dir: cache_dir, load_path_cache: false, autoload_paths_cache: false)
load Gem.bin_path('rubocop', 'rubocop')

So I close this pull request in favor of binstub.
Thank you for the comment!

@hanachin hanachin closed this May 29, 2019

@bquorning

This comment has been minimized.

Copy link
Member

commented May 29, 2019

I was going to suggest something along the lines of that binstub, but I couldn’t figure out how to make it work 😅So thanks for sharing that binstub template, I’m sure that pattern can be used to speed up various Ruby CLI tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.