Overview

Find unused classes within your app

Why does dead code detection and deletion matter?

Over time, dead code can accumulate until it starts to take up a real chunk of the app. This can be due to A/B test branches that are no longer used, helper classes for long-deleted features, or all other manner of things. This has the following issues:

  • Increased build time, due to compiling code that won’t be needed
  • Worse code cleanliness, with unused classes polluting the file structure, grep results, etc.
  • Longer startup time, because it will take up extra space in the binary that usually gets loaded from disk (for a deeper dive into how a binary is loaded from disk, see our blog post.

How does Reaper work? (on iOS)

Reaper is an SDK that you can put into your production or alpha users' apps to report which Swift and Objective-C classes were used for each user session. We take those reports and generate a list of all the classes in the binary, sorted by the version of the app they were last used in for at least one user session. After a few versions have been released with the SDK, the results are ready to look at. If a class hasn't been used since at least a few versions back, then in all likelihood it’s dead code that can be removed. The SDK will detect any unused classes within the main binary specifically. It's easy to integrate, either as a standalone binary or as a Cocoapod, and adds very little overhead to your app. It adds less than 20kb to the binary size, and less than 1ms to startup time.