# Compute Units

All notable changes in compute units usage will be documented in this file.

The changes are calculated by comparing the current results with the last version's results. Increase in usage 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**
> The 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**
> The results may vary depending on Solana version.

## [Unreleased]

Solana version: 1.16.0

| Instruction                 | Compute Units | +/- |
| --------------------------- | ------------- | --- |
| accountInfo1                | 1015          | -   |
| accountInfo2                | 1475          | -   |
| accountInfo4                | 1964          | -   |
| accountInfo8                | 3841          | -   |
| accountEmptyInit1           | 5817          | -   |
| accountEmpty1               | 1149          | -   |
| accountEmptyInit2           | 10402         | -   |
| accountEmpty2               | 1754          | -   |
| accountEmptyInit4           | 19508         | -   |
| accountEmpty4               | 2540          | -   |
| accountEmptyInit8           | 37265         | -   |
| accountEmpty8               | 5016          | -   |
| accountSizedInit1           | 5924          | -   |
| accountSized1               | 1214          | -   |
| accountSizedInit2           | 10680         | -   |
| accountSized2               | 1873          | -   |
| accountSizedInit4           | 19970         | -   |
| accountSized4               | 2762          | -   |
| accountSizedInit8           | 38122         | -   |
| accountSized8               | 5353          | -   |
| accountUnsizedInit1         | 6052          | -   |
| accountUnsized1             | 1338          | -   |
| accountUnsizedInit2         | 10929         | -   |
| accountUnsized2             | 1778          | -   |
| accountUnsizedInit4         | 20339         | -   |
| accountUnsized4             | 3136          | -   |
| accountUnsizedInit8         | 39096         | -   |
| accountUnsized8             | 5952          | -   |
| boxedAccountEmptyInit1      | 6034          | -   |
| boxedAccountEmpty1          | 888           | -   |
| boxedAccountEmptyInit2      | 10633         | -   |
| boxedAccountEmpty2          | 1401          | -   |
| boxedAccountEmptyInit4      | 19311         | -   |
| boxedAccountEmpty4          | 2424          | -   |
| boxedAccountEmptyInit8      | 37136         | -   |
| boxedAccountEmpty8          | 4659          | -   |
| boxedAccountSizedInit1      | 6130          | -   |
| boxedAccountSized1          | 917           | -   |
| boxedAccountSizedInit2      | 10828         | -   |
| boxedAccountSized2          | 1463          | -   |
| boxedAccountSizedInit4      | 19703         | -   |
| boxedAccountSized4          | 2543          | -   |
| boxedAccountSizedInit8      | 37919         | -   |
| boxedAccountSized8          | 4898          | -   |
| boxedAccountUnsizedInit1    | 6240          | -   |
| boxedAccountUnsized1        | 972           | -   |
| boxedAccountUnsizedInit2    | 11048         | -   |
| boxedAccountUnsized2        | 1570          | -   |
| boxedAccountUnsizedInit4    | 20138         | -   |
| boxedAccountUnsized4        | 2768          | -   |
| boxedAccountUnsizedInit8    | 38791         | -   |
| boxedAccountUnsized8        | 5347          | -   |
| boxedInterfaceAccountMint1  | 2296          | -   |
| boxedInterfaceAccountMint2  | 4129          | -   |
| boxedInterfaceAccountMint4  | 7783          | -   |
| boxedInterfaceAccountMint8  | 15281         | -   |
| boxedInterfaceAccountToken1 | 2023          | -   |
| boxedInterfaceAccountToken2 | 3582          | -   |
| boxedInterfaceAccountToken4 | 6692          | -   |
| boxedInterfaceAccountToken8 | 13098         | -   |
| interfaceAccountMint1       | 2364          | -   |
| interfaceAccountMint2       | 5030          | -   |
| interfaceAccountMint4       | 9803          | -   |
| interfaceAccountMint8       | 18400         | -   |
| interfaceAccountToken1      | 2091          | -   |
| interfaceAccountToken2      | 3948          | -   |
| interfaceAccountToken4      | 7547          | -   |
| interface1                  | 1059          | -   |
| interface2                  | 1479          | -   |
| interface4                  | 1900          | -   |
| interface8                  | 3646          | -   |
| program1                    | 1053          | -   |
| program2                    | 1467          | -   |
| program4                    | 1878          | -   |
| program8                    | 3598          | -   |
| signer1                     | 1018          | -   |
| signer2                     | 1484          | -   |
| signer4                     | 1984          | -   |
| signer8                     | 3880          | -   |
| systemAccount1              | 1072          | -   |
| systemAccount2              | 1590          | -   |
| systemAccount4              | 2195          | -   |
| systemAccount8              | 4305          | -   |
| uncheckedAccount1           | 1014          | -   |
| uncheckedAccount2           | 1475          | -   |
| uncheckedAccount4           | 1965          | -   |
| uncheckedAccount8           | 3841          | -   |

### Notable changes

---

## [0.28.0]

Solana version: 1.16.0

| Instruction                 | Compute Units | +/-            |
| --------------------------- | ------------- | -------------- |
| accountInfo1                | 1015          | 🔴 **+6.39%**  |
| accountInfo2                | 1475          | 🟢 **-5.87%**  |
| accountInfo4                | 1964          | 🟢 **-4.61%**  |
| accountInfo8                | 3841          | -              |
| accountEmptyInit1           | 5817          | 🟢 **-2.37%**  |
| accountEmpty1               | 1149          | 🔴 **+5.41%**  |
| accountEmptyInit2           | 10402         | 🟢 **-1.63%**  |
| accountEmpty2               | 1754          | 🟢 **-5.29%**  |
| accountEmptyInit4           | 19508         | -              |
| accountEmpty4               | 2540          | 🟢 **-4.01%**  |
| accountEmptyInit8           | 37265         | -              |
| accountEmpty8               | 5016          | -              |
| accountSizedInit1           | 5924          | 🟢 **-2.29%**  |
| accountSized1               | 1214          | 🔴 **+6.96%**  |
| accountSizedInit2           | 10680         | -              |
| accountSized2               | 1873          | 🟢 **-4.73%**  |
| accountSizedInit4           | 19970         | -              |
| accountSized4               | 2762          | -              |
| accountSizedInit8           | 38122         | -              |
| accountSized8               | 5353          | -              |
| accountUnsizedInit1         | 6052          | 🟢 **-2.28%**  |
| accountUnsized1             | 1338          | 🔴 **+7.64%**  |
| accountUnsizedInit2         | 10929         | 🟢 **-1.02%**  |
| accountUnsized2             | 1778          | 🟢 **-6.08%**  |
| accountUnsizedInit4         | 20339         | -              |
| accountUnsized4             | 3136          | 🔴 **+1.03%**  |
| accountUnsizedInit8         | 39096         | -              |
| accountUnsized8             | 5952          | 🟢 **-1.64%**  |
| boxedAccountEmptyInit1      | 6034          | 🟢 **-2.05%**  |
| boxedAccountEmpty1          | 888           | 🟢 **-9.02%**  |
| boxedAccountEmptyInit2      | 10633         | 🟢 **-1.40%**  |
| boxedAccountEmpty2          | 1401          | 🟢 **-6.54%**  |
| boxedAccountEmptyInit4      | 19311         | -              |
| boxedAccountEmpty4          | 2424          | 🟢 **-4.19%**  |
| boxedAccountEmptyInit8      | 37136         | -              |
| boxedAccountEmpty8          | 4659          | 🟢 **-2.53%**  |
| boxedAccountSizedInit1      | 6130          | 🟢 **-2.01%**  |
| boxedAccountSized1          | 917           | 🟢 **-8.57%**  |
| boxedAccountSizedInit2      | 10828         | 🟢 **-1.34%**  |
| boxedAccountSized2          | 1463          | 🟢 **-5.86%**  |
| boxedAccountSizedInit4      | 19703         | -              |
| boxedAccountSized4          | 2543          | 🟢 **-3.75%**  |
| boxedAccountSizedInit8      | 37919         | -              |
| boxedAccountSized8          | 4898          | 🟢 **-2.10%**  |
| boxedAccountUnsizedInit1    | 6240          | 🟢 **-2.10%**  |
| boxedAccountUnsized1        | 972           | 🟢 **-9.07%**  |
| boxedAccountUnsizedInit2    | 11048         | 🟢 **-1.45%**  |
| boxedAccountUnsized2        | 1570          | 🟢 **-6.49%**  |
| boxedAccountUnsizedInit4    | 20138         | 🟢 **-1.05%**  |
| boxedAccountUnsized4        | 2768          | 🟢 **-4.52%**  |
| boxedAccountUnsizedInit8    | 38800         | -              |
| boxedAccountUnsized8        | 5347          | 🟢 **-3.08%**  |
| boxedInterfaceAccountMint1  | 2296          | -              |
| boxedInterfaceAccountMint2  | 4129          | 🔴 **+1.88%**  |
| boxedInterfaceAccountMint4  | 7783          | 🔴 **+3.25%**  |
| boxedInterfaceAccountMint8  | 15281         | 🔴 **+3.96%**  |
| boxedInterfaceAccountToken1 | 2023          | 🔴 **+16.47%** |
| boxedInterfaceAccountToken2 | 3582          | 🔴 **+22.34%** |
| boxedInterfaceAccountToken4 | 6692          | 🔴 **+26.48%** |
| boxedInterfaceAccountToken8 | 13098         | 🔴 **+28.35%** |
| interfaceAccountMint1       | 2364          | 🟢 **-6.56%**  |
| interfaceAccountMint2       | 5030          | 🔴 **+6.43%**  |
| interfaceAccountMint4       | 9803          | 🔴 **+3.94%**  |
| interfaceAccountMint8       | 18400         | 🔴 **+3.90%**  |
| interfaceAccountToken1      | 2091          | 🔴 **+19.15%** |
| interfaceAccountToken2      | 3948          | 🔴 **+22.95%** |
| interfaceAccountToken4      | 7547          | 🔴 **+25.66%** |
| interface1                  | 1059          | 🔴 **+6.01%**  |
| interface2                  | 1479          | 🟢 **-6.04%**  |
| interface4                  | 1900          | 🟢 **-4.81%**  |
| interface8                  | 3646          | -              |
| program1                    | 1053          | 🔴 **+5.41%**  |
| program2                    | 1467          | 🟢 **-6.74%**  |
| program4                    | 1878          | 🟢 **-6.01%**  |
| program8                    | 3598          | 🟢 **-1.45%**  |
| signer1                     | 1018          | 🔴 **+6.26%**  |
| signer2                     | 1484          | 🟢 **-5.84%**  |
| signer4                     | 1984          | 🟢 **-4.57%**  |
| signer8                     | 3880          | -              |
| systemAccount1              | 1072          | 🔴 **+5.82%**  |
| systemAccount2              | 1590          | 🟢 **-5.69%**  |
| systemAccount4              | 2195          | 🟢 **-4.48%**  |
| systemAccount8              | 4305          | -              |
| uncheckedAccount1           | 1014          | 🔴 **+6.40%**  |
| uncheckedAccount2           | 1475          | 🟢 **-5.87%**  |
| uncheckedAccount4           | 1965          | 🟢 **-4.61%**  |
| uncheckedAccount8           | 3841          | -              |

### Notable changes

---

## [0.27.0]

Solana version: 1.14.16

| Instruction                 | Compute Units | +/- |
| --------------------------- | ------------- | --- |
| accountInfo1                | 954           | N/A |
| accountInfo2                | 1567          | N/A |
| accountInfo4                | 2059          | N/A |
| accountInfo8                | 3856          | N/A |
| accountEmptyInit1           | 5958          | N/A |
| accountEmpty1               | 1090          | N/A |
| accountEmptyInit2           | 10574         | N/A |
| accountEmpty2               | 1852          | N/A |
| accountEmptyInit4           | 19557         | N/A |
| accountEmpty4               | 2646          | N/A |
| accountEmptyInit8           | 37541         | N/A |
| accountEmpty8               | 5043          | N/A |
| accountSizedInit1           | 6063          | N/A |
| accountSized1               | 1135          | N/A |
| accountSizedInit2           | 10783         | N/A |
| accountSized2               | 1966          | N/A |
| accountSizedInit4           | 19975         | N/A |
| accountSized4               | 2787          | N/A |
| accountSizedInit8           | 38381         | N/A |
| accountSized8               | 5359          | N/A |
| accountUnsizedInit1         | 6193          | N/A |
| accountUnsized1             | 1243          | N/A |
| accountUnsizedInit2         | 11042         | N/A |
| accountUnsized2             | 1893          | N/A |
| accountUnsizedInit4         | 20495         | N/A |
| accountUnsized4             | 3104          | N/A |
| accountUnsizedInit8         | 39419         | N/A |
| accountUnsized8             | 6051          | N/A |
| boxedAccountEmptyInit1      | 6160          | N/A |
| boxedAccountEmpty1          | 976           | N/A |
| boxedAccountEmptyInit2      | 10784         | N/A |
| boxedAccountEmpty2          | 1499          | N/A |
| boxedAccountEmptyInit4      | 19500         | N/A |
| boxedAccountEmpty4          | 2530          | N/A |
| boxedAccountEmptyInit8      | 37415         | N/A |
| boxedAccountEmpty8          | 4780          | N/A |
| boxedAccountSizedInit1      | 6256          | N/A |
| boxedAccountSized1          | 1003          | N/A |
| boxedAccountSizedInit2      | 10975         | N/A |
| boxedAccountSized2          | 1554          | N/A |
| boxedAccountSizedInit4      | 19884         | N/A |
| boxedAccountSized4          | 2642          | N/A |
| boxedAccountSizedInit8      | 38182         | N/A |
| boxedAccountSized8          | 5003          | N/A |
| boxedAccountUnsizedInit1    | 6374          | N/A |
| boxedAccountUnsized1        | 1069          | N/A |
| boxedAccountUnsizedInit2    | 11211         | N/A |
| boxedAccountUnsized2        | 1679          | N/A |
| boxedAccountUnsizedInit4    | 20351         | N/A |
| boxedAccountUnsized4        | 2899          | N/A |
| boxedAccountUnsizedInit8    | 39118         | N/A |
| boxedAccountUnsized8        | 5517          | N/A |
| boxedInterfaceAccountMint1  | 2299          | N/A |
| boxedInterfaceAccountMint2  | 4053          | N/A |
| boxedInterfaceAccountMint4  | 7538          | N/A |
| boxedInterfaceAccountMint8  | 14699         | N/A |
| boxedInterfaceAccountToken1 | 1737          | N/A |
| boxedInterfaceAccountToken2 | 2928          | N/A |
| boxedInterfaceAccountToken4 | 5291          | N/A |
| boxedInterfaceAccountToken8 | 10205         | N/A |
| interfaceAccountMint1       | 2530          | N/A |
| interfaceAccountMint2       | 4726          | N/A |
| interfaceAccountMint4       | 9431          | N/A |
| interfaceAccountMint8       | 17709         | N/A |
| interfaceAccountToken1      | 1755          | N/A |
| interfaceAccountToken2      | 3211          | N/A |
| interfaceAccountToken4      | 6006          | N/A |
| interface1                  | 999           | N/A |
| interface2                  | 1574          | N/A |
| interface4                  | 1996          | N/A |
| interface8                  | 3651          | N/A |
| program1                    | 999           | N/A |
| program2                    | 1573          | N/A |
| program4                    | 1998          | N/A |
| program8                    | 3651          | N/A |
| signer1                     | 958           | N/A |
| signer2                     | 1576          | N/A |
| signer4                     | 2079          | N/A |
| signer8                     | 3895          | N/A |
| systemAccount1              | 1013          | N/A |
| systemAccount2              | 1686          | N/A |
| systemAccount4              | 2298          | N/A |
| systemAccount8              | 4336          | N/A |
| uncheckedAccount1           | 953           | N/A |
| uncheckedAccount2           | 1567          | N/A |
| uncheckedAccount4           | 2060          | N/A |
| uncheckedAccount8           | 3855          | N/A |

---
