Skip to content
CAI
Software that uses CAICheck a score

rails/bootsnap

77.8

Strong · 19 September 2026

2.1k

lines of production code

Ruby

with C

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Bootsnap is a Ruby library that accelerates application startup by caching load paths and precompiling code into binary formats. It manages cache storage for instruction sequences and YAML, while providing a CLI and parallel worker pool to efficiently precompile gems and files. The system includes robust instrumentation, environment variable configuration, and compatibility handling for various Ruby implementations and containerized environments.

How it got here

2017 — Bootsnap 1.26.0 release and modernization

11 changes.

This period focused on releasing Bootsnap version 1.26.0, which introduced a new CLI, expanded instrumentation, and improved compatibility with Ruby 2.7+ and Psych 4. The work involved refactoring the C extension to remove CRC32 dependencies, redesigning the setup API for better configuration control, and enhancing load path caching accuracy. Additionally, the project migrated to the Rails organization, updated its build system, and significantly expanded test coverage to support these structural changes.

2019–2026 — parallel precompilation and test expansion

7 changes.

This period focused on enhancing Bootsnap's performance by introducing a cgroup-aware parallel worker pool for gem precompilation. It also significantly expanded test coverage, adding integration tests for app booting, YJIT interaction, and detailed unit tests for compile caches and core extension behaviors.

Features

Added bootsnap executable for precompiling gems

A new executable script at exe/bootsnap has been added to the project. This script allows users to precompile gems using the Bootsnap library without needing to boot the full application, providing a faster way to prepare the environment.

exe · high confidence

Bootsnap upgraded to version 1.26.0 with new CLI and setup infrastructure

Bootsnap has been upgraded to version 1.26.0, introducing a new command-line interface (CLI) for precompiling gems and files, a dedicated \bootsnap/setup\ entry point for easier initialization, and a \bootsnap/bundler\ helper to detect Bundler environments. The update also adds support for TruffleRuby, improves platform compatibility checks, and refactors the load path and compile cache setups to be more robust and configurable.

lib/bootsnap · high confidence

Parallel precompilation with cgroup-aware worker pool

Bootsnap now uses a new WorkerPool to parallelize precompilation, significantly speeding up the process on multi-core systems. The pool automatically detects the number of available processors and respects cgroup CPU limits (both v1 and v2) to avoid over-subscribing resources in containerized environments. It also includes a safety check to detect faulty fork behavior (such as in certain QEMU/Docker setups) and gracefully falls back to single-threaded execution if needed.

lib/bootsnap/cli · high confidence

Behavioural changes

Bootsnap 1.26.0 release and repository maintenance

This release (1.26.0) introduces a hook API to customize Ruby compilation, adds instrumentation events for cache hits, and provides a way to log hit rate statistics. It fixes a cache corruption issue when revalidating stale YAML entries, handles the top-level \Coverage\ constant being defined without being the stdlib module, and works around a potential Ruby SEGV if instrumentation raises an error. The repository has been migrated to the Rails organization, updated to require Ruby 2.7+, and now uses GitHub Actions for CI. Documentation has been significantly expanded with performance metrics, usage instructions, and environment variable details, while the RuboCop configuration has been modernized to use local plugins and exclude specific paths.

(repo-wide) · high confidence

Improved load path caching accuracy and performance with built-in feature detection

The load path cache now correctly handles Ruby's built-in features (like 'enumerator') that do not correspond to files on disk, preventing incorrect cache hits. It also introduces a LoadedFeaturesIndex to accurately track already-loaded features by short name, ensuring that adding a new $LOAD\_PATH element with a conflicting file name does not cause duplicate loads. Path scanning is optimized by using a native implementation (where available) to avoid N+1 stat calls, and the cache store now uses atomic writes and version checks to handle concurrent transactions and upgrade incompatibilities more robustly. Additionally, the cache ignores 'node\_modules' directories by default and supports relative paths in the load path.

_lib/bootsnap/load\_path\cache · high confidence

Redesigned setup API with environment variable control and new instrumentation

The \Bootsnap.setup\ method has been significantly refactored to support new configuration options including \ignore\_directories\, \readonly\, and \revalidation\ modes, while deprecating the \compile\_cache\_json\ argument. Cache directories are now organized under a unified root structure. The library now supports configuration via environment variables (e.g., \BOOTSNAP\_CACHE\_DIR\, \BOOTSNAP\_READONLY\) and allows loading an optional config file. Additionally, new \log\_stats!\ and \log!\ methods provide built-in instrumentation to monitor cache hits, misses, and other events for debugging and performance analysis.

lib · high confidence

Refactor C extension to remove CRC32 dependency and modernize build configuration

The C extension no longer includes the custom CRC32 implementation (crc32.c and bootsnap.h), resolving a symbol conflict with zlib. The build system (extconf.rb) has been updated to conditionally apply strict compiler flags (like -Wpedantic) only when not targeting JRuby or TruffleRuby, and to properly detect features like fdatasync and fstatat. Additionally, the extension now supports O\_NOATIME on non-Windows platforms and uses a new, more robust cache key structure (bs\_cache\_key) that incorporates Ruby version and compile options, replacing the previous xattr-based keying mechanism.

ext · high confidence

Refactored Kernel\#require and removed ActiveSupport integration

The \Kernel\#require\ implementation has been rewritten to bypass the cache entirely when Bootsnap is disabled or when a feature is already loaded, and to handle fallback scans by checking the loaded features index before falling back to the native loader. The previous \Kernel\#load\ and \Module\#autoload\ patches have been removed. Additionally, the integration with \ActiveSupport::Dependencies\ has been deleted, meaning Bootsnap no longer monkey-patches ActiveSupport's autoload and dependency resolution mechanisms.

_lib/bootsnap/load\_path\_cache/core\ext · high confidence

Refactored instruction sequence and YAML compilation caches with Ruby bug workarounds and Psych 4 support

The ISeq and YAML compile caches have been significantly restructured to improve reliability and compatibility. The ISeq cache now uses a modular Compiler class that detects and applies workarounds for specific Ruby bugs (such as \#18250 and \#22023) and handles code coverage mode more gracefully by falling back to runtime compilation when necessary. The YAML cache has been rewritten to support Psych 4, properly handling options like \symbolize\_names\ and \freeze\, and now uses recursive MessagePack serialization for complex types like Date, DateTime, and Regexp instead of the previous Marshal fallback. These changes ensure the cache remains effective across different Ruby versions and YAML library configurations.

_lib/bootsnap/compile\cache · high confidence

Refine test runner scripts and add minimal support test helper

The test execution environment has been updated to improve reliability and consistency. The \bin/testunit\ script now uses \exec\ to replace the shell process with Ruby, ensuring proper signal handling, and enables Ruby warnings (\-w\) to catch potential issues during test runs. A new \bin/test-minimal-support\ script has been added to facilitate testing against minimal Ruby support configurations by setting up the environment and running Bootsnap. Additionally, the \bin/console\ script now includes a \frozen\_string\_literal\ pragma for better string handling.

bin · high confidence

Test coverage

Added bootsnap setup helper for tests; Added integration tests for app boot, Kernel require behavior, and YJIT cache interaction; Added test fixtures for coverage and frozen string literal integration; Added tests for ISeq cache and YAML compile cache behaviors; Added tests for Kernel\#require and Kernel\#load caching behavior; Expanded test coverage for Bootsnap setup, CLI, and cache behavior; Expanded test coverage for LoadPathCache components.

Dependencies

Bootsnap 0.2.0: Ruby 2.7+ requirement, msgpack upgrade, and dependency restructuring

Bootsnap now requires Ruby 2.7 or higher and drops support for earlier versions. The runtime dependency on msgpack has been updated to version 1.5, and the snappy dependency has been removed. Development dependencies such as bundler, rake, rubocop, and minitest have been moved from the gemspec to the Gemfile, and the gem's homepage and metadata have been updated to reflect its move to the Rails organization.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 78.

Lenses

  • Code Health 99
  • Architecture 100
  • Maturity 71
  • Readiness 72
  • Security 93

Changes since last survey

  • 300 commits — 260 feature/other, 40 fixes

By area

  • (root) — 104 commits
  • (repo) — 95 commits
  • lib/bootsnap — 44 commits
  • ext/bootsnap — 27 commits
  • .github/workflows — 10 commits
  • test/load_path_cache — 6 commits
  • lib/bootsnap.rb — 5 commits
  • test/test_helper.rb — 3 commits
  • test/fixtures — 2 commits
  • .devcontainer/devcontainer.json — 1 commit
  • .github/dependabot.yml — 1 commit
  • .github/probots.yml — 1 commit
  • test/cli_test.rb — 1 commit

Notable commits

  • fix: Avoid leaking a method in Object when testing for Parse.y bugs
  • fix: Check for [Bug #22023] by checking Ruby version rather than a canary
  • fix: Fix $LOAD_PATH.dup to be Ractor shareable
  • fix: Fix Bootsnap.unload_cache!
  • fix: Fix ISeq.input_to_output to respect default external encoding
  • fix: Fix LoadPathCache deduplication
  • fix: Fix Regexp and Date handling in YAML compile cache
  • fix: Fix CompileCache::YAML cache options mutation & symbolize_{keys,names}
  • fix: Fix Kernel#autoload's fallback path always bing executed
  • fix: Fix can't modify frozen Hash error.
  • fix: Fix a cache corruption issue during revalidation
  • fix: Fix a compatibility issues with statically linked libraries (prism)
  • fix: Fix absolute path support for ignored directories in PathScanner.native_call
  • fix: Fix an uninitialized instance variable warning in test
  • fix: Fix bootsnap setup in environments without bundler
  • fix: Fix bundle path check and consolidate common code in PathScanner
  • fix: Fix cgroup CPU limits detection in CLI.
  • fix: Fix compatibility with minitest 5.19
  • fix: Fix encoding in Ruby [Bug #22023] workaround
  • fix: Fix extconf.rb to look for fdatasync in unistd.h
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

rails/bootsnap was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 67a7290e0318ad59e8c97bb81c816dcf23801f20 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.