# How we built a Ruby library that saves 50% in testing time

DevFeed: [How we built a Ruby library that saves 50% in testing time](<https://devfeed.tech/articles/how-we-built-a-ruby-library-that-saves-50-in-testing-time-83498.md>)

Original publisher: [Read original article](<https://www.datadoghq.com/blog/engineering/ruby-test-impact-analysis/>)

Author: Andrey Marchenko; Gillian McGarvey

Published: 2024-11-01T00:00:00Z

Content type: article

Language: en

Sources: [Datadog](<https://devfeed.tech/sources/datadog.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Test automation](<https://devfeed.tech/topics/test-automation.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [RSpec](<https://devfeed.tech/topics/rspec.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [ci](<https://devfeed.tech/tags/ci.md>), [compaction](<https://devfeed.tech/tags/compaction.md>), [intelligent-test-runner](<https://devfeed.tech/tags/intelligent-test-runner.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [test-impact-analysis](<https://devfeed.tech/tags/test-impact-analysis.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tracing](<https://devfeed.tech/tags/tracing.md>)

## AI overview

Datadog describes building a Ruby library for test impact analysis that maps tests to the source files they execute, enabling selective test runs in CI. The article explains how the team moved from Ruby coverage and TracePoint to interpreter events and allocation tracing, then optimized file tracking to reduce overhead while addressing code-less classes. The resulting tool has a median 25% performance overhead and is reported to be 5-10 times faster than the alternatives the team tried, with known limitations around external processes and data files.

## Source excerpt

Learn how we built a test impact analysis library in Ruby, the challenges we faced, the solutions we found, and what we discovered about tracing the Ruby VM.