rubygems/rubygems — pull request #376 by charliesome (2012-09-17 11:51:20+00:00)
Title: Don't evaluate every single gemspec when rubygems loads

This patch adds gemspec caching to RubyGems. At the moment, every time RubyGems loads, it loads every single `.gemspec` and evaluates it. This is a huge performance issue.

This patch caches these `Gem::Specification` objects as marshalled data in the same directory as the gemspecs. In my testing, this significantly reduces the time taken for RubyGems to load.

I've been using this script to test load times:

```ruby
require "rubygems"
require "yajl/version"

puts Yajl::VERSION
```

Without caching, this script takes about 280 milliseconds to execute. With this patch, the time taken drops down to about 210 milliseconds.

Cheers