---
name: "diag_codePerformance"
type: command
status: ok
groups: ["Diagnostic", "Performance Profiling"]
arma3_since: "1.58"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/diag_codePerformance
revid: 377699
updated: 2026-01-02T09:03:27Z
---

# diag_codePerformance

*Command · Diagnostic, Performance Profiling · Arma 3 v1.58*

## Description

Attempts to run given code with given arguments given number of cycles in unscheduled environment and returns average time it took to run the code as well as actual number of executions performed.
The command will return as soon as possible if the tested code is slow and the duration of the command exceeds 1 second.
Engine alternative to [BIS_fnc_codePerformance](../functions/BIS_fnc_codePerformance.md).

## Syntax

```sqf
diag_codePerformance [code, arguments, cycles]
```

**Parameters:**

- `code`: [Code](../topics/Code.md) - code to compare performance
- `arguments`: [Anything](../topics/Anything.md) - (Optional, default [nil](../commands/nil.md)) arguments to pass to the code in _this variable. Default: [nil](../commands/nil.md)
- `cycles`: [Number](../topics/Number.md) - (Optional, default 100000) wanted number of cycles to run the given code. > 1000 is recommended
- `ignoreTimeLimit`: [Boolean](../topics/Boolean.md) - (Optional, default false) - ignore the 1 second timelimit, and always run the provided number of cycles (except in multiplayer) *(since arma3 2.14)*

**Returns:** [Array](../topics/Array.md) with [duration, cycles]
- duration: [Number](../topics/Number.md) - average duration of 1 execution in milliseconds
- cycles: [Number](../topics/Number.md) - actual number of cycles executed

## Examples

### Example 1

```sqf
private _result = diag_codePerformance [{ private _a = 123; }, 0, 10000];
```

## Multiplayer

For security purposes, this command will only run for 1 cycle in multiplayer, unless in-game debug console is available via [description.ext](../topics/Description.ext.md) option or Eden attribute setting.

## See also

[diag_log](../commands/diag_log.md) · [BIS_fnc_codePerformance](../functions/BIS_fnc_codePerformance.md) · [Code Optimisation](../topics/Code_Optimisation.md)

<sub>Source: [BI Community Wiki — diag codePerformance](https://community.bistudio.com/wiki/diag_codePerformance) (revision 377699).</sub>
