Advertisement
glitchdetector

FiveM Runcode Benchmark Tool

Feb 29th, 2020
627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. --[[
  2.     Lua Code / Native Profiler
  3.     Can be used in runcode
  4.     Make functions with a name and run it
  5.     Automatically runs the profiler and views the results
  6.     Records 3 frames
  7. ]]
  8. local iterations = 10000
  9. local tests = {
  10.     ["GetPlayerPed(-1)"] = function()
  11.         GetPlayerPed(-1)
  12.     end,
  13.     ["PlayerPedId()"] = function()
  14.         PlayerPedId()
  15.     end,
  16.     ["PlayerId() to GetPlayerPed"] = function()
  17.         GetPlayerPed(PlayerId())
  18.     end,
  19. }
  20.  
  21. -- command hax
  22. RegisterCommand("profiler", function() end)
  23. RegisterCommand("record", function() end)
  24. RegisterCommand("view", function() end)
  25.  
  26. CreateThread(function()
  27.     ExecuteCommand("profiler record 4")
  28.     Wait(0)
  29.     while ProfilerIsRecording() do
  30.         for test, func in next, tests do
  31.             ProfilerEnterScope(test)
  32.             for i = 0, iterations do
  33.                 func()
  34.             end
  35.             ProfilerExitScope()
  36.         end
  37.         Wait(0)
  38.     end
  39.     ExecuteCommand("profiler view")
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement