Project

fastup

0.0
No commit activity in last 3 years
No release in over 3 years
index load path to accelerate boot of bundler-based apps with lots of gem dependencies
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Fastup

Fastup builds an index from $LOAD_PATH and patches require to use that index to significantly speed up booting up large Rails apps with many dependencies.

When require 'code' is called, Ruby searches each element of $LOAD_PATH, attempting to load code.rb from each directory in $LOAD_PATH. Watching the output of strace while starting a Ruby program reveals a large number of failed attempts to open non-existent files, until the correct path is found. The index built by fastup allows skipping many of these failed attempts.

The speedup is most noticeable in applications with many dependencies. With few dependencies, the overhead of fastup will cause a small slowdown. Test the speedup first, to see if fastup is worth it or not for any particular application.

plot

Usage

fastup/autoapply should be required after bundler/setup and before Bundler.require, or more generally, after $LOAD_PATH has been populated with all dependencies and before most of them have been require'd.

For example in config/boot.rb of a Rails app:

require 'rubygems'

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'fastup/autoapply'

Production Ready?

This has not been used in production.