> ## Documentation Index
> Fetch the complete documentation index at: https://krono.fabianpiper.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance

> Improve orderbook performance with throttling and debouncing.

Performance configuration options allow you to balance responsiveness with resource usage.

## Basic Configuration

```tsx theme={null}
import { Orderbook } from '@krono/kit'

export const App = () => {
  return (
    <Orderbook.Root
      config={{
        symbol: 'BTC/USD',
        throttleMs: 100,
        debounceMs: 50
      }}
    >
      {/* Components */}
    </Orderbook.Root>
  )
}
```

## Update Control

### throttleMs

Limits how frequently the orderbook updates.

**Type:** `number`

**Default:** `100`

```tsx theme={null}
<Orderbook.Root
  config={{
    symbol: 'BTC/USD',
    throttleMs: 100
  }}
>
  {/* Components */}
</Orderbook.Root>
```

**Use Cases:**

* `50ms` - High-frequency trading
* `100ms` - Standard interfaces (recommended)
* `250ms` - Low-priority displays
* `500ms` - Historical analysis

### debounceMs

Delays processing of rapid updates.

**Type:** `number`

**Default:** `0`

```tsx theme={null}
<Orderbook.Root
  config={{
    symbol: 'BTC/USD',
    debounceMs: 50
  }}
>
  {/* Components */}
</Orderbook.Root>
```

<Warning>
  High `debounceMs` values introduce latency. Use sparingly.
</Warning>

## Performance Comparison

| Use Case     | throttleMs | debounceMs | Updates/sec | Latency |
| ------------ | ---------- | ---------- | ----------- | ------- |
| HFT          | 50         | 0          | 20          | \~50ms  |
| Standard     | 100        | 0          | 10          | \~100ms |
| Low Priority | 250        | 100        | 4           | \~350ms |

## Optimization Tips

* **Profile Your App:** Use DevTools to measure render performance
* **Match Update Frequency:** Trading: 50-100ms. Monitoring: 250-500ms
* **Reduce Depth:** Lower `depth` and `limit` improve performance
* **Use Throttle Over Debounce:** Throttle provides predictable intervals

## Related

<CardGroup cols={2}>
  <Card title="Orderbook" icon="chart-candlestick" href="/docs/kit/configuration/orderbook">
    Configure the core orderbook behavior.
  </Card>

  <Card title="History" icon="history" href="/docs/kit/configuration/history">
    Enable snapshot tracking and playback features for historical analysis and debugging.
  </Card>

  <Card title="Asset Pairs" icon="coins" href="/docs/kit/configuration/asset-pairs">
    Configure how trading pair metadata is fetched and cached. Required for auto-populating `tickSize`.
  </Card>

  <Card title="Overview" icon="cog" href="/docs/kit/configuration/overview">
    See all configuration options in one place with complete TypeScript types and defaults.
  </Card>
</CardGroup>
