Compute units
A transaction may spend up to 1,400,000 compute units; an instruction gets 200,000 unless it asks for more. Pass units to raise a run's budget. A script that spends its budget stops with "Computational budget exceeded" and changes nothing. The units below are measured on the Weft program; the Weft VM in the browser meters with the same table, so the playground's meter reads close to the chain.
| Op | Units |
|---|---|
| const / nil / true / false | 18 |
| pop / dup | 57 |
| load / store variable | 86 |
| add / sub | 29 |
| mul | 146 |
| div / mod / idiv | 311 |
| pow | 492 |
| neg / not | 110 |
| compare | 75 |
| concat | 682 +89 per 16 bytes |
| jump | 39 |
| branch | 37 |
| call | 302 +85 per argument |
| return | 45 |
| closure | 193 |
| list | 122 +137 per item |
| map | 307 +471 per entry |
| index / set index | 352 |
| call a builtin | 444 +85 per argument |
A run that keeps storage pays for it once per run, beyond each load and store:
| Storage | Units |
|---|---|
| First load or store | 1,358 +193 per stored value |
| Write back after a store | 2,957 +193 per stored value |
| Grow or create the account | 3,502 plus its rent, from the signer |