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:

Cargo.toml
go.sum
maven-metadata.xml
package-lock.json
pnpm-lock.yaml
yarn.lock

Excluded file extensions:

.betterer.results
.bundle
.classpath
.lock.hcl
.lock
.snap
.suo

Excluded directories:

generated

and on the top level only,

vendor

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?