Measure performance with resmon and the profiler
At 60 frames per second one frame is about 16.7 ms, shared by the game and every resource. A Wait(0) loop is not automatically bad; its body runs every frame, so unnecessary work inside it is the problem. This lesson teaches you to measure before and after instead of promising made-up benchmark numbers. You measure with resmon first, then reach for the built-in profiler when resmon says something is slow but does not say why.
Build it
Make the resource folder
Inside your server's resources folder, create this folder:
resources/qu_performance_resmon
Create the files
Create this exact file layout:
resources/qu_performance_resmon/
fxmanifest.lua
client.lua
Write fxmanifest.lua
Open fxmanifest.lua and paste this:
fx_version 'cerulean'
game 'gta5'
client_script 'client.lua'
There is no lua54 'yes' line. As of June 2025 that directive is deprecated and ignored: Lua 5.4 is the only Lua runtime now, so you leave it out.
Write the lesson code
Open client.lua and paste this. It draws a marker only when enabled and nearby, and otherwise sleeps. Record your own resmon numbers because cost depends on hardware, client build, and the work inside the loop.
local markerOn = false
local markerCoords = vector3(-269.0, -955.0, 31.2) -- near Legion Square
RegisterCommand('resmontoggle', function()
markerOn = not markerOn
print('[qu_performance_resmon] marker on: ' .. tostring(markerOn))
end, false)
CreateThread(function()
while true do
local sleep = 1000 -- far away or off: sleep a full second
if markerOn then
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local dist = #(coords - markerCoords)
if dist < 20.0 then
sleep = 0 -- close enough to see it: run every frame
DrawMarker(1, markerCoords.x, markerCoords.y, markerCoords.z - 1.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.3,
0, 180, 255, 120, false, false, 2, false, nil, nil, false)
end
end
Wait(sleep)
end
end)
Start and test it
Open server.cfg and add this line:
ensure qu_performance_resmon
Save, then run this in the txAdmin Live Console (the FXServer.exe window, or the txAdmin Live Console -- NOT the in-game F8 console):
restart qu_performance_resmon
resmon is a developer-only command. If you launch FiveM normally it answers Access denied for command resmon. Enable developer mode first: right-click your FiveM shortcut, choose Properties, and add +set moo 31337 to the end of the Target field (or run a non-production update channel such as Beta/Latest). Restart FiveM, join the server, open the developer console with F8, and turn on the client resource monitor:
resmon 1
Find qu_performance_resmon in the list. With the marker off, its cost sits near 0.00 ms. Now run the command from the F8 console:
resmontoggle
You will see the print confirming the toggle. Teleport or walk to Legion Square (around -269, -955) and watch the cost climb while the marker is on screen, then fall back toward zero the moment you walk away.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- How it works
- If something went wrong
- What you can do now
- Try it yourself
The remainder of Measure performance with resmon and the profiler is available to FiveM School members.