glitchdetector icon

FiveM Runcode Benchmark Tool

glitchdetector | PRO | 03/01/20 01:49:11 AM UTC | 0 ⭐ | 892 👁️ | Never ⏰ | []
Lua |

990 B

|

None

|

0 👍

/

0 👎

--[[
    Lua Code / Native Profiler
    Can be used in runcode
    Make functions with a name and run it
    Automatically runs the profiler and views the results
    Records 3 frames
]]
local iterations = 10000
local tests = {
    ["GetPlayerPed(-1)"] = function()
        GetPlayerPed(-1)
    end,
    ["PlayerPedId()"] = function()
        PlayerPedId()
    end,
    ["PlayerId() to GetPlayerPed"] = function()
        GetPlayerPed(PlayerId())
    end,
}
 
-- command hax
RegisterCommand("profiler", function() end)
RegisterCommand("record", function() end)
RegisterCommand("view", function() end)
 
CreateThread(function()
    ExecuteCommand("profiler record 4")
    Wait(0)
    while ProfilerIsRecording() do
        for test, func in next, tests do
            ProfilerEnterScope(test)
            for i = 0, iterations do
                func()
            end
            ProfilerExitScope()
        end
        Wait(0)
    end
    ExecuteCommand("profiler view")
end)

Comments