# Problem code `'frame-budget'`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts`, `tables/problems.json` and `services/onsite-scripter/scripts/contract-docs-what-to-do.json` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

A member of [`ProblemCode`](../api/ProblemCode.md) · stable · since 2.0.0

Frame hooks together averaged over 3 ms per frame across the last 60 drawn frames, or a `constrain` over 1 ms across its last 60 calls; recorded at most once per 10 s for each, with the count and the mean in `message`.

## What to do

Make [`session.onFrame`](../api/Session.onFrame.md) hooks cheaper (all together under 3 ms a frame) and a drag's [`DragOptions.constrain`](../api/DragOptions.constrain.md) cheaper (under 1 ms a call): precompute outside them, and remove hooks you no longer need with the function [`onFrame`](../api/Session.onFrame.md) returns or their `signal`.

## Where the declaration names it

- [`DragOptions.constrain`](../api/DragOptions.constrain.md): Budget 1 ms, averaged over its last 60 calls ('frame-budget').
- [`Input.drag`](../api/Input.drag.md): A slow `constrain` records 'frame-budget'.
- [`Session.onFrame`](../api/Session.onFrame.md): Budget: all hooks together 3 ms per frame, averaged over the last 60 drawn frames ('frame-budget', at most once per 10 s).
- [`testing.FakeSession.record`](../api/testing.FakeSession.record.md): For Problems the fake has no route to, such as 'render-lost', 'engine-conflict' or 'frame-budget'.

The set is open: handle a code you don't know (`'other'`).
