rad~$

Performance Optimization Guide

Learn how to optimize Rad for maximum performance in your Ruby projects.

Performance Comparison

Rad is designed from the ground up for speed. Compared to traditional Ruby dependency managers, Rad is typically 3-8× faster for cold cache operations, and continues to outperform with warm caches.

Project SizeGem CountCold Install (Rad)Warm Install (Rad)Cold Install (Bundler)Improvement
Small91.94s0.59s7.33s~3.8x faster
Medium202.26s0.61s15.71s~7.0x faster
Large456.30s2.53s52.40s~8.3x faster

Tests performed on an Apple M2 Pro with Ruby 3.2. Small project: 9 gems (sinatra, sqlite3, puma, faker, etc.). Medium project: 20 gems (Rails, sqlite3, sidekiq, devise, etc.). Large project: 45 gems (Rails, sqlite3, sidekiq, devise, aws-sdk-s3, graphql, etc.).

Large Project Installation Time (smaller is better)

Bundler52.40s
Rad6.30s

Installing a large project (45 gems) on an Apple M2 Pro with Ruby 3.2 using a cold cache.

Lazy Loading Optimization

Rad uses an advanced lazy loading approach for gem metadata, which significantly reduces network traffic, memory usage, and speeds up resolution.

How Lazy Loading Works

Rad implements a two-step fetching process that only downloads the metadata you actually need:

  • Reduced network traffic by 30-40%
  • Lower memory usage by 20-30%
  • Faster resolution speed by 10-20%
  • Smart error handling with automatic retries and exponential backoff

Configuring Lazy Loading

Lazy loading is enabled by default, but you can configure it using environment variables or command-line flags:

terminal
# Control lazy loading via environment variable
RAD_LAZY_LOADING=true rad install
terminal
# Use command line flag
rad update --no-lazy-loading

Caching Strategies

One of the most effective ways to improve performance is to properly utilize Rad's caching mechanisms.

Cache TTL Configuration

Configure how long cached data remains valid:

terminal
# Set cache TTL to 12 hours (good for CI environments)
RAD_CACHE_TTL=43200 rad install

Platform Caching

Enable platform compatibility caching for larger projects:

terminal
# Enable platform caching
RAD_PLATFORM_CACHING=true rad install
terminal
# Combine optimizations for maximum speed
RAD_LAZY_LOADING=true RAD_PLATFORM_CACHING=true rad install

Platform Optimization

Rad can significantly improve performance with its advanced platform detection capabilities.

Platform Detection

terminal
rad platform list
Available Platforms: - ruby - x86_64-linux - x86_64-darwin - arm64-darwin - ... Your current platform: arm64-darwin

Platform Compatibility Check

terminal
rad check --platform arm64-darwin
✓ All gems are compatible with platform arm64-darwin

Memory Usage Optimization

Rad is designed to be memory efficient, typically using a fraction of the memory that Bundler requires.

terminal
rad stats project
Project statistics: - Dependencies: 67 - Gem versions evaluated: 423 - Peak memory usage: 74 MB (Bundler would use 250+ MB) - Resolution time: 103 ms

Execution Speed Optimization

Rad's exec command runs commands with project gems loaded significantly faster than bundle exec:

terminal
rad exec rails server
=> Booting Puma => Rails 7.1.1 application starting in development => Run `bin/rails server --help` for more startup options Puma starting in single mode... * Listening on http://127.0.0.1:3000

CI Optimization

In CI environments, these techniques will produce the fastest builds:

terminal
# Example optimization for CI environments
RAD_LAZY_LOADING=true RAD_PLATFORM_CACHING=true RAD_CACHE_TTL=43200 rad install

Best Practices Checklist

  • Keep lazy loading enabled (it's on by default)
  • Use platform caching for large projects
  • Set appropriate cache TTL for your environment
  • Only install the platforms you need
  • Utilize Rad's memory-efficient resolver
  • Implement proper CI caching for faster builds
  • Use rad exec instead of bundle exec for faster command execution

Coming Soon: Even More Optimizations

The Rad team is continuously working on performance improvements, including algorithm enhancements, more efficient memory usage, and parallel gem fetching capabilities.

GitHub