# Overhead

> What recording costs, as measured by the benchmark of ormaos-python on two workloads on one machine.

Recording adds work to every call of your code. A program that makes very many small calls runs many times slower while it is recorded, and its recording is large. A program that spends its time in I/O or inside libraries is affected much less.

## The measurement

The numbers below are from `bench/RESULTS.md` of ormaos-python at the pinned commit, written by `bench/run.py`: N: 20 runs of each row, after 1 discarded, on CPython 3.13.17. Each time is the whole command, from start to exit, in milliseconds of wall-clock time; with Ormaos it includes starting the CLI and reading the recording back for the summary.

| Workload | Without Ormaos | With `ormaos run -- python` | Ratio |
|---|---|---|---|
| CPU: 150,000 calls of small pure-Python functions | 81.6 ms | 2798.2 ms | x34.28 |
| I/O: a SQLite file and 200 small files | 34.5 ms | 265.7 ms | x7.69 |

The medians. The CPU workload is the worst case: the cost grows with the number of calls.

## By capability set

| Capability set | CPU workload | I/O workload |
|---|---|---|
| context only (`ormaos run` around a Python that starts without the recorder) | 130.2 ms (x1.59) | 86.3 ms (x2.50) |
| calls and exceptions (`--no-io`) | 2544.4 ms (x31.17) | 138.0 ms (x4.00) |
| calls, exceptions and path | 2741.4 ms (x33.58) | 141.7 ms (x4.10) |
| calls, exceptions and io (the default) | 2798.2 ms (x34.28) | 265.7 ms (x7.69) |

The machine, the spread of the runs (p25 to p75, min to max) and what each recording held are in [bench/RESULTS.md](https://github.com/ormaos/ormaos-python/blob/968f69776c7c4f9ef5c04867ed7a0c229786bc19/bench/RESULTS.md). These are two workloads on one machine; another program has another number of calls per second, and another cost.

## Recording less

- `ormaos run --only context,exceptions,io -- <command>` leaves out the call tree. With any choice other than `context`, calls are still followed while the program runs and left out when the recording is written: the recording is smaller, the program is not much faster.
- `ormaos run --only context` watches nothing inside the program.
- `ormaos run --no-io` records without I/O.
- `with ormaos.record():` records only one block.

## Other costs

- Describing data reads the whole of a DataFrame or array at every call that receives or returns it, bounded by size and by time per process (see [Limits](/python/reference/limits.md)).
- `tree`, `exceptions`, `io`, `path` and `diff` load the whole recording to answer.
- `ormaos run` runs three read-only git commands before the command, and waits up to one second at the end for Python processes that are still alive.

---

Source: https://docs.ormaos.com/python/concepts/overhead/ · ormaos 0.0.1 · ormaos-python 968f69776c · ormaos-examples 6e27be5922
