# Binary Size

All notable changes in program binary size will be documented in this file.

The changes are calculated by comparing the current results with the last version's results. Increase in size is shown with 🔴 and decrease is shown with 🟢.

The programs and their tests are located in [/tests/bench](https://github.com/coral-xyz/anchor/tree/master/tests/bench).

> **Note**
> Results documented in this file are autogenerated. Running the tests will update the current results when necessary, manually editing the results should be avoided.

> **Warning**
> Results may vary depending on Solana version.

## [Unreleased]

Solana version: 2.0.8

| Program | Binary Size | -                        |
| ------- | ----------- | ------------------------ |
| bench   | 1,097,424   | 🔴 **+306,416 (38.74%)** |

### Notable changes

- lang: Use closures for `init` constraints to reduce the stack usage of `try_accounts`. Note that the binary size increase is exaggerated for the bench program because it uses unusual number of `init` constraints. Impact for normal programs will be a lot less severe. ([#2939](https://github.com/coral-xyz/anchor/pull/2939)).

---

## [0.30.1]

Solana version: 1.18.17

| Program | Binary Size | -   |
| ------- | ----------- | --- |
| bench   | 791,008     | -   |

### Notable changes

---

## [0.30.0]

Solana version: 1.18.8

| Program | Binary Size | -                      |
| ------- | ----------- | ---------------------- |
| bench   | 791,008     | 🔴 **+47,952 (6.45%)** |

### Notable changes

- Upgrade Solana to `1.18.8` ([#2867](https://github.com/coral-xyz/anchor/pull/2867)).

---

## [0.29.0]

Solana version: 1.17.0

| Program | Binary Size | +/-                      |
| ------- | ----------- | ------------------------ |
| bench   | 743,056     | 🟢 **-417,904 (36.00%)** |

### Notable changes

- `Box` the `anchor_lang::Result` error variants ([#2600](https://github.com/coral-xyz/anchor/pull/2600)).
- Change all accounts to have a reference to `AccountInfo` instead of cloning ([#2656](https://github.com/coral-xyz/anchor/pull/2656)).
- Reduce unnecessary cloning ([#2663](https://github.com/coral-xyz/anchor/pull/2663)).

---

## [0.28.0]

Solana version: 1.16.0

| Program | Binary Size | +/-                    |
| ------- | ----------- | ---------------------- |
| bench   | 1,160,960   | 🔴 **+23,272 (2.05%)** |

### Notable changes

- Upgrading Solana to `1.16`. The difference in binary size between `0.27.0` and `0.28.0` is the direct result of upgrading Solana version(both build tools and crates) ([#2512](https://github.com/coral-xyz/anchor/pull/2512)).

---

## [0.27.0]

Solana version: 1.14.16

| Program | Binary Size | +/- |
| ------- | ----------- | --- |
| bench   | 1,137,688   | N/A |

---
