Benchmarks to compare the performance of different scripting runtimes in FiveM (Legacy and Enhanced), similar to AvarianKnight/cfx-runtime-benchmarks.
Note
It is yet unclear whether the Lua 5.4 performance on Enhanced is affected by the profiler. See citizenfx/rfc#510.
Runtimes marked with (L) are from FiveM Legacy, and runtimes marked with (E) are from FiveM Enhanced.
The 1m iteration benchmarks were each ran 6 times, and the results were taken from the profiler recording of the final benchmark iteration. Immediately after, the 10k iteration benchmark was ran, of which a profiler recording was taken.
Ran with the following specs:
- CPU:
Intel Core i7-12700F - GPU:
NVIDIA GeForce RTX 2080 - RAM:
64 GB 4800Mhz DDR5 - Legacy server:
35945 - Legacy client:
35945 - Enhanced server:
139 - Enhanced client:
138
Note
This does not necessarily indicate the performance of a runtime! This overhead is often caused by the resource monitor itself or the running machine, and can usually be ignored.
This is an overhead that the resource monitor may show for a runtime in the CPU msec when not actively running code.
| Lua 5.4 (L) | Lua 5.4 OAL (L) | Lua 5.4 (E) | Node.js 22 (L) | Node.js 26 (E) | Mono (L) | Mono (E) | .NET 10.0 (E) |
|---|---|---|---|---|---|---|---|
| 0.00ms | 0.00ms | 0.00ms | 0.01 ms | 0.01ms | 0.04ms | 0.01ms | 0.02ms |
Note
Enhanced runtimes are not included, as svgui does not seem to exist there.
| Lua 5.4 (L) | Lua 5.4 OAL (L) | Node.js 26 (L) | Mono (L) |
|---|---|---|---|
| 0.00ms | 0.00ms | 0.00ms | 0.30ms |
Note
DNF means the client crashed due to the code taking too long. Refer to the Server Benchmarks instead.
| Test | Lua 5.4 (L) | Lua 5.4 OAL (L) | Lua 5.4 (E) | Node.js 22 (L) | Node.js 26 (E) | Mono (L) | Mono (E) | .NET 10.0 (E) |
|---|---|---|---|---|---|---|---|---|
| Game Natives: Void Return Type | 67.25ms | 47.81ms | 142.69ms | 82.79ms | 21.08ms | 49.42ms | 28.76ms | 27.98ms |
| Game Natives: Number Return Type | 169.14ms | 130.22ms | 226.69ms | 209.10ms | 87.71ms | 138.10ms | 136.99ms | 138.26ms |
| Game Natives: String Return Type | 176.59ms | 133.20ms | 488.61ms | 235.05ms | 336.08ms | 226.19ms | 355.05ms | 353.38ms |
| Game Natives: Vector Return Type | 244.78ms | 195.12ms | 307.95ms | 538.08ms | 205.65ms | 202.10ms | 224.00ms | 219.50ms |
| Cfx Natives: Void Return Type | 31.89ms | 12.77ms | 226.80ms | 44.53ms | 8.06ms | 18.79ms | 16.68ms | 16.62ms |
| Cfx Natives: Number Return Type | 52.73ms | 33.30ms | 199.47ms | 78.53ms | 27.30ms | 102.35ms | 34.34ms | 34.95ms |
| Cfx Natives: String Return Type | 41.08ms | 16.62ms | 217.60ms | 89.49ms | 45.90ms | 91.39ms | 40.66ms | 45.51ms |
| String Concatenation (Simple) | 21.18s | 20.95s | 20.16s | 28.43ms | 15.49ms | DNF | DNF | DNF |
| String Concatenation (Optimized) | 26.14ms | 26.04ms | 21.52ms | 9.94ms | 5.98ms | 4.15ms | 2.10ms | 2.08ms |
| Vector2 Math | 15.06ms | 15.30ms | 12.31ms | 0.42ms | 0.26ms | 2.76ms | 1.71ms | 0.21ms |
| Vector3 Math | 15.60ms | 15.79ms | 15.83ms | 0.43ms | 0.26ms | 5.72ms | 1.97ms | 0.21ms |
| Test | Lua 5.4 (L) | Lua 5.4 OAL (L) | Lua 5.4 (E) | Node.js 22 (L) | Node.js 26 (E) | Mono (L) | Mono (E) | .NET 10.0 (E) |
|---|---|---|---|---|---|---|---|---|
| Game Natives: Void Return Type | 0.74ms | 0.52ms | 1.19ms | 1.00ms | 0.21ms | 0.53ms | 0.28ms | 0.28ms |
| Game Natives: Number Return Type | 1.74ms | 1.38ms | 2.07ms | 2.56ms | 0.92ms | 1.50ms | 1.32ms | 1.34ms |
| Game Natives: String Return Type | 1.78ms | 1.38ms | 4.67ms | 2.75ms | 3.49ms | 2.38ms | 3.54ms | 3.70ms |
| Game Natives: Vector Return Type | 2.49ms | 2.03ms | 3.24ms | 6.23ms | 2.10ms | 2.18ms | 2.31ms | 2.28ms |
| Cfx Natives: Void Return Type | 0.32ms | 0.14ms | 1.66ms | 0.53ms | 0.09ms | 0.19ms | 0.17ms | 0.18ms |
| Cfx Natives: Number Return Type | 0.54ms | 0.34ms | 1.95ms | 0.87ms | 0.28ms | 1.11ms | 0.35ms | 0.34ms |
| Cfx Natives: String Return Type | 0.44ms | 0.16ms | 2.13ms | 0.97ms | 0.47ms | 0.85ms | 0.42ms | 0.41ms |
| String Concatenation (Simple) | 13.31ms | 13.52ms | 4.39ms | 0.08ms | 0.02ms | 48.52ms | 5.24ms | 4.88ms |
| String Concatenation (Optimized) | 0.28ms | 0.26ms | 0.22ms | 0.10ms | 0.07ms | 0.04ms | 0.02ms | 0.02ms |
| Vector2 Math | 0.17ms | 0.17ms | 0.12ms | 0.14ms | 0.003ms | 0.03ms | 0.03ms | 0.002ms |
| Vector3 Math | 0.16ms | 0.16ms | 0.15ms | 0.09ms | 0.002ms | 0.06ms | 0.02ms | 0.003ms |
| Test | Lua 5.4 (L) | Lua 5.4 OAL (L) | Lua 5.4 (E) | Node.js 22 (L) | Node.js 26 (E) | Mono (L) | Mono (E) | .NET 10.0 (E) |
|---|---|---|---|---|---|---|---|---|
| Cfx Natives: Void Return Type | 34.02ms | 14.20ms | 115.51ms | 95.96ms | 7.67ms | 36.77s | 17.36ms | 17.45ms |
| Cfx Natives: Number Return Type | 51.19ms | 33.57ms | 145.63ms | 123.45ms | 20.27ms | 36.96s | 33.59ms | 34.65ms |
| Cfx Natives: String Return Type | 40.81ms | 17.05ms | 172.89ms | 120.24ms | 39.11ms | 36.95s | 43.72ms | 42.88ms |
| String Concatenation (Simple) | 19.62s | 19.40s | 30.19s | 23.25ms | 7.82ms | 233.86s | 119.79s | 122.75s |
| String Concatenation (Optimized) | 23.69ms | 25.20ms | 21.95ms | 14.18ms | 10.45ms | 4.02ms | 1.92ms | 3.93ms |
| Vector2 Math | 16.68ms | 15.14ms | 11.48ms | 0.41ms | 0.26ms | 17.63ms | 1.68ms | 0.21ms |
| Vector3 Math | 16.72ms | 16.36ms | 14.58ms | 0.41ms | 0.26ms | 17.91ms | 2.10ms | 0.20ms |
| Test | Lua 5.4 (L) | Lua 5.4 OAL (L) | Lua 5.4 (E) | Node.js 22 (L) | Node.js 26 (E) | Mono (L) | Mono (E) | .NET 10.0 (E) |
|---|---|---|---|---|---|---|---|---|
| Cfx Natives: Void Return Type | 0.41ms | 0.14ms | 1.06ms | 0.97ms | 0.08ms | 379.45ms | 0.17ms | 0.19ms |
| Cfx Natives: Number Return Type | 0.61ms | 0.32ms | 1.29ms | 1.41ms | 0.19ms | 370.41ms | 0.33ms | 0.35ms |
| Cfx Natives: String Return Type | 0.40ms | 0.16ms | 1.47ms | 1.23ms | 0.37ms | 369.10ms | 0.42ms | 0.42ms |
| String Concatenation (Simple) | 8.49ms | 9.06ms | 8.71ms | 0.02ms | 0.03ms | 39.32ms | 6.31ms | 6.30ms |
| String Concatenation (Optimized) | 0.26ms | 0.31ms | 0.27ms | 0.08ms | 0.54ms | 0.09ms | 0.02ms | 0.01ms |
| Vector2 Math | 0.16ms | 0.17ms | 0.29ms | 0.005ms | 0.003ms | 0.21ms | 0.01ms | 0.002ms |
| Vector3 Math | 0.16ms | 0.17ms | 0.18ms | 0.005ms | 0.003ms | 0.23ms | 0.02ms | 0.002ms |
- Install and ensure
[benchmark]. - Run
profiler record 500. - Run
benchmark_<platform>_<runtime> [iterationCount].- Iteration count is 1,000,000 by default.
- Platform is either
clientorserver. - Runtime is the name of a resource in
[benchmark], e.g.lua54,lua54_oal,mono,node26, etc. - Examples:
benchmark_client_lua54_oal,benchmark_server_net10
- Wait for the profiler to finish.
- Run
profiler view.