Advertisement
Guest User

Untitled

a guest
Jul 12th, 2015
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. Performance difference between GTA V version 372 and 393
  2.  
  3. Calling SET_CURRENT_PED_WEAPON 1000 times via ScriptHookV and RAGEPluginHook (code used is provided below):
  4. 372: ~582ms (RPH: ~585ms)
  5. 393: ~2480ms (RPH: ~2490ms)
  6.  
  7. Performance on version 323/350 is most likely even better due to even less/no obfuscation than 372.
  8.  
  9.  
  10. Code used for ScriptHookV (performance counter code from http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter):
  11.  
  12. Ped playerPed = PLAYER::PLAYER_PED_ID();
  13. uint weaponHash = 0xA2719263;
  14. StartCounter();
  15.  
  16. for (int i = 0; i < 1000; i++)
  17. {
  18. WEAPON::SET_CURRENT_PED_WEAPON(playerPed, weaponHash, true);
  19. }
  20.  
  21. double timePassed = GetCounter();
  22. char buffer[32];
  23. sprintf(buffer, "Time passed: %f", timePassed);
  24. MessageBoxA(0, buffer, "", 0);
  25.  
  26. Code used for RPH:
  27.  
  28. System.Diagnostics.Stopwatch Stopwatch = new System.Diagnostics.Stopwatch();
  29. uint playerHandle = Game.LocalPlayer.Character.Handle.Value;
  30. Stopwatch.Restart();
  31. for (int i = 0; i < 1000; i++)
  32. {
  33. Rage.Native.NativeFunction.CallByHash<ulong>(12535367907453402124uL, playerHandle, 0xA2719263, true);
  34. }
  35. Game.LogTrivial("Time spent on 1000 calls: " + Stopwatch.ElapsedMilliseconds);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement