• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Optimizations and MySQL
#5
1 -


Code:
CMD:speedtest(playerid) {
? ? new var, string[20];

? ? var = GetTickCount();

? ? for(new i; i < 100000; i) {//it has to be several times because these functions run very fast, to be more precise I increase the number of times
? ? ? ? SendClientMessage(playerid, -1, "Bem vindo ao Brasil.");
? ? }

? ? printf("Time taken to run SendClientMessage %d milliseconds", GetTickCount() - var);

? ? var = GetTickCount();

? ? for(new i; i < 100000; i) {
? ? ? ? format(string, sizeof(string), "Bem vindo ao Brasil");
? ? ? ? SendClientMessage(playerid, -1, string);
? ? }
? ? printf("Time taken to run SendClientMessage with format %d milliseconds", GetTickCount() - var);
? ? return 1;
}


Time taken to run SendClientMessage 81 milliseconds
Time taken to run SendClientMessage with format 117 milliseconds

OBS:I recommend running the script that you would like to test on a server with nothing, and one test at a time, anything in the background can disrupt the result.


2 - I recommend you use your gamemode variables to save, save the information only when the player leaves your server. And again, use mysql_tquery

2? Another tip, do not spend your time saving string on your server, but avoid use giant strings without any need.
Code:
Discord: Marllun#6297
  Reply


Messages In This Thread
Optimizations and MySQL - by RhaegarX - 2021-02-27, 10:15 PM
RE: Optimizations and MySQL - by RhaegarX - 2021-02-28, 09:49 PM
RE: Optimizations and MySQL - by destiezk - 2021-02-28, 11:31 PM
RE: Optimizations and MySQL - by Pinch - 2021-03-01, 02:41 PM
RE: Optimizations and MySQL - by destiezk - 2021-03-01, 03:20 PM
RE: Optimizations and MySQL - by Virsenas - 2021-03-01, 12:09 AM
RE: Optimizations and MySQL - by Marllun - 2021-03-01, 01:37 PM
RE: Optimizations and MySQL - by RhaegarX - 2021-03-02, 01:52 AM
RE: Optimizations and MySQL - by Y_Less - 2021-03-07, 01:13 PM

Forum Jump: