Batch size

Batch size measures how much work is bundled up in a change. Swarmia offers tools for evaluating pull request batch size by looking at the total number of changes in a single pull request.

Definition

Batch size is calculated by the lines of code changed (lines added + lines removed) in a given pull request.

Excluding auto-generated files

Repositories often contain generated files, which could be related to e.g. package dependencies. In order to provide an accurate view of the real changes, Swarmia automatically cleans up the total change count of some commonly used generated files.

Excluded file names:

Filename
Reason / Ecosystem

package-lock.json

NPM lockfile (JS/TS)

yarn.lock

Yarn lockfile (JS/TS)

pnpm-lock.yaml

pnpm lockfile (JS/TS)

gradlew

Gradle wrapper script (Android)

gradlew.bat

Gradle wrapper script (Windows)

maven-metadata.xml

Maven metadata (Android/Java)

local.properties

Local Android config (machine-specific)

Podfile.lock

CocoaPods lockfile (iOS)

Cartfile.resolved

Carthage lockfile (iOS)

Package.resolved

SwiftPM lockfile (iOS)

Cargo.toml

Manifest file for Cargo (Rust)

go.sum

Go dependency checksums

Excluded file extensions:

Extension
Reason / Ecosystem

betterer.results

Betterer test snapshots (JS/TS)

snap

Snapshot test files (Jest, AVA, etc.)

iml

IntelliJ / Android Studio module files

classpath

Eclipse / Gradle classpath metadata

bundle

Java/Maven/OSGi bundle descriptors (generated)

lock

Generic lockfiles (Gradle, NPM, CocoaPods, etc.)

lock.hcl

Terraform lockfile

pbxuser

Xcode project user settings

mode1v3

Old Xcode user state

mode2v3

Old Xcode user state

perspectivev3

Xcode UI layout state

xcuserstate

Xcode workspace state

suo

Visual Studio solution user options

log

Build/runtime/crash logs

Excluded directories:

Directory
Reason / Ecosystem

.gradle

Gradle cache (Android)

app/build/generated

Android generated sources

app/build/intermediates

Android intermediate build outputs

.xcworkspace

Xcode workspace metadata (iOS/macOS)

.xcuserdata

Xcode user-specific project data

.idea

IntelliJ/Android Studio project settings

.vscode

VS Code project settings

node_modules

JavaScript dependencies (auto-generated)

Excluded top-level directories:

Directory
Reason / Ecosystem

build

Build output (Android)

DerivedData

Xcode build output (iOS/macOS)

Example

A pull request with 541 lines added and 215 lines removed (+541 -215) has a batch size of 756.

Why it matters

Splitting work into small increments is a great way to improve delivery.

Small pull requests are easier to plan, review, and deploy.

We suggest keeping the pull request size under 500 lines of code and paying attention to work that ends up spanning over 1,000+ lines.

Read more in Analyzing pull request batch size

How to use it

In Swarmia, the chart that shows the pull request size vs cycle time shows a set of pull requests in the selected time frame and charts them based on their individual cycle time and the total number of lines of code changed in the pull request. This chart allows you to see correlations between the size of a pull request and its cycle time.

Pull request size vs. cycle time plot in Swarmia

Seeing the distribution of larger batch sizes and higher cycle times can indicate that your team needs to focus on delivering smaller batch sizes. This change can improve not only your cycle time but also your quality.

See also Analyzing pull request batch size

Where to find it

You can find batch size metrics under Insights → Code → Batch size.

Last updated

Was this helpful?