Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add simple cache to Bundler.load_gemspec

In some projects, for example those with 10s of local gemspecs, use of
`git ls-files` for spec.files, or specs requiring significant source
to get at a spec.version; this change to cache load_gemspec results in
notable performance gains.

The cache also avoids loading these same gemspecs repeatedly with
different LOAD_PATH values.
  • Loading branch information...
commit 3d4163a05d7dc7a33095e6567933bac41225d06d 1 parent 691c8ac
@dekellum dekellum authored indirect committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/bundler.rb
View
5 lib/bundler.rb
@@ -270,6 +270,11 @@ def read_file(file)
end
def load_gemspec(file)
+ @gemspec_cache ||= {}
+ @gemspec_cache[File.expand_path(file)] ||= load_gemspec_uncached(file)
+ end
+
+ def load_gemspec_uncached(file)
path = Pathname.new(file)
# Eval the gemspec from its parent directory
Dir.chdir(path.dirname.to_s) do
Please sign in to comment.
Something went wrong with that request. Please try again.