> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-achievements/reference/performance.md).

# Performance

What runs, how often, and what it costs.

Idle cost is **0.00 ms**. There are no per-frame loops anywhere except while the menu is actually open.

## On the client

| Runs            | How often                                                  |
| --------------- | ---------------------------------------------------------- |
| Crime detection | Every 250ms while alive                                    |
| Distance        | Once a second, **only while driving**                      |
| Landmarks       | Every 2 seconds, and **stops for good** once all are found |
| Nearby players  | Every 3 seconds                                            |

One-shot detections switch their own thread off the moment they fire. Nothing runs before the player has loaded.

## On the server

| Runs           | How often        |
| -------------- | ---------------- |
| Playtime       | Every minute     |
| Money sampling | Every 30 seconds |
| Saving         | Every 2 minutes  |
| Rarity recount | Every 15 minutes |

The client-sync thread only starts when something is queued and stops itself when nothing is.

## Database

* Completions, rewards and admin actions are written **immediately**
* Partial progress is **batched**, so grinding a 250-step counter is one query rather than 250
* Batched writes are a single multi-row statement
* Opening the menu costs **no query at all**

## Memory

Cached player data is cleared the moment somebody disconnects, along with their entries in every tracker's bookkeeping.

{% hint style="success" %}
Every tracker and detector can be switched off individually in `config.lua`, and a disabled one creates no thread and registers no handler — so turning something off really does cost nothing.
{% endhint %}
