Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was investigating the slow startup performance of a Rails application using Bumbler (https://github.com/nevir/Bumbler)
I was quite surprised to always see
ruby-units
in place 1 or 2 as the worst offender, adding about 1 second to the total startup time.After some investigation I noticed that this comes from an unfortunate interaction with the
bootsnap
gem (bootsnap
improves the startup time of an app by caching and pre-scanning the load path, see https://github.com/Shopify/bootsnap#path-pre-scanning)By modifying
$LOAD_PATH
twice, bootsnap requires rescans the whole load path twice by adding the current directory to the load path. The duration depends on the number of installed gems. In my case this is adding a considerable delay to the application startup.ruby-units/lib/ruby-units.rb
Lines 1 to 2 in ec39140
ruby-units/lib/ruby_units/namespaced.rb
Lines 1 to 5 in ec39140
Fortunately these modifications are not necessary, because
require_relative
is used which already considers the current directory.My guess: previously
require
was used and the load path modifications were actually necessary. After switching to require_relative they became useless but weren't removed.Anyway, this PR removes them.