Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

[WIP]Test Script for script speed


Nevitro
 Share

Recommended Posts

Hello programmers. First, there is my code [copy that and paste into txt file, after that name this "Nevitrotest.cs"]:

 

using System;using System.Windows.Forms;using GTA;namespace Nevitrotest{public class SCRIPT_SPEED_TEST : Script{bool run_test=false;double summarum;int time_run,time_run_limit=10,x,interval=0;int[] getallx = new int[10]; public SCRIPT_SPEED_TEST() {       this.Tick += this.TICK_DO_ALL_TIME; Game.Console.Print("------------------------------\n Nevitro script testing how much time run script with different Interval\n Type 'nvconfig' or 'nvtest'"); BindConsoleCommand("nvtest", new ConsoleCommandDelegate(RUN_TEST)); BindConsoleCommand("nvconfig", new ConsoleCommandDelegate(TEST_CONFIG)); }public void RUN_TEST(ParameterCollection Parameter){Game.Console.Print("Please wait... Test will run in :");Wait(1000);Game.Console.Print("3...");Wait(1000);Game.Console.Print("2..");Wait(1000);Game.Console.Print("1...");Wait(1000);Game.Console.Close();Game.DisplayText("Testing script speed RUN");run_test = true;x=0;time_run=1;summarum=0;GTA.Native.Function.Call("SETTIMERC", 0);}public void TEST_CONFIG(ParameterCollection Parameter){Wait(100);Game.Console.Close();Game.Console.Print("\n------------------INTERVAL CONFIG NEVITRO SCRIPT\n Please, close this console and set interval with UP/DOWN arrows.\n At the end, please press Enter.\n If You do not want change interval, just press Enter after close console\n TIP: Bigger interval will give smaller amount speed of script. \n Scripts should run lees times than normal [interval=0]");Game.DisplayText("How big interval for script You want?");do {Player.CanControlCharacter = false;if (Game.isKeyPressed(Keys.Up)){interval=interval+1;Game.DisplayText("Interval ="+interval);}if (Game.isKeyPressed(Keys.Down)){interval=interval-1;if (interval<0) interval=0;Game.DisplayText("Interval ="+interval);}Wait(20);}while (!(Game.isKeyPressed(Keys.Enter)));Wait(100);Game.Console.Print("\n------------------HOW MUCH TEST CONFIG NEVITRO SCRIPT\n Please, close this console and set how much tests You want with UP/DOWN arrows.\n At the end, please press Enter.\n If You do not want change amount of tests, just press Enter after close console\n Bigger amount mean more accurate results. \n");Game.DisplayText("How much tests You want? for script You want?");do{Player.CanControlCharacter = false;if (Game.isKeyPressed(Keys.Up)){time_run_limit=time_run_limit+1;Game.DisplayText("Amount of tests ="+time_run_limit);}if (Game.isKeyPressed(Keys.Down)){time_run_limit=time_run_limit-1;if (time_run_limit<1) time_run_limit=1;Game.DisplayText("Amount of tests ="+time_run_limit);}Wait(50);}while (!(Game.isKeyPressed(Keys.Enter)));Player.CanControlCharacter = true;Game.Console.Open();Game.Console.Print("Interval of script is "+interval+" ms");Game.Console.Print("Amount tests of script is "+time_run_limit+"\n");Game.Console.Print("Type here 'nvtest'");}   public void TICK_DO_ALL_TIME(object sender, EventArgs e)   { if (run_test==true) { 	if (GTA.Native.Function.Call<int>("TIMERC")<1000) 	{ 	x=x+1; 	Wait(interval); 	} 	else 	{ 	Game.DisplayText("Testing speed ..."); 	getallx[time_run-1]=x; 	Game.Console.Print("Test "+time_run+" run "+x+" times."); 	time_run=time_run+1; 	x=0; 	GTA.Native.Function.Call("SETTIMERC", 0);   if (time_run==(time_run_limit+1))   {   for (int xyz=0; xyz<=9; xyz++)   {   summarum=summarum+getallx[xyz];   }   summarum=summarum/time_run_limit;   run_test=false;   Game.Console.Print("AVG times how much run script: "+Math.Round(summarum,0)+"\nwith interval: "+interval+"\nand with "+time_run_limit+" tests");   Game.DisplayText("Testing script speed STOP");   Game.Console.Open();   } 	} }}}}

 

 

Codes allowed in game console:

"nvconfig"

"nvtest"

 

nvconfig is for set interval and limits tests in game. Interval is it time before script do next loop. Second option, limit of tests, allow to user make very accurace test. Bigger value give more precise results.

 

nvtest - make test. When test run, You can do anything. Also play with others scripts.

 

Instructions:

This scripts generaly is for developers, but also normal user can use this like benchmark for scripts.

If interval is 0 and You have big amount of AVG it is good. If Your AVG amount is under 20 - Your computer must really work hard now. Try to disable some programs in Windows and run again this test. Better? Please write here.

 

Developer on this script, can see what is difference for computer if interval is not set to 1 or 2... Why i say this? Because in GTA 4, many programmist think everyone super computer. Why script must check every milisecond what we do? For me, 10 scripts running and added "this.Interval = 1" make my game run faster... Only 1 ms for every script...

So, with my script You can see in different locations, situations how many loops do script. Your script also should do same amount of loops.

 

I just left for You to fun. Small, fast benchmark wink.gif

 

Forgot, my results [5 AVG for one situation]:

Small window, the lowest graphic, interval 0, place near house: 26, 25, 24,26,25

Fullscreen, medium graphic, interval 0, that same place: 15,16,17,16,16

Fullscreen, medium graphic, interval 1, that same place: 16,16,16,15,14

 

1 loop less, for simple x=x+1 script... what should if You put there some more diffucult things to do? I do not have time for this now, but test for Yourself smile.gif

Edited by Nevitro
Link to comment
Share on other sites

i use 10 ms of interval, what kills me is the lag ares where Wait(1000) wait more than one sec hehe

Link to comment
Share on other sites

blowjobcumpussy

nice i will test myself soon, btw u can do x++; instead of x = x+ 1; wink.gif

Link to comment
Share on other sites

Yeah i know, but sometimes if didn't work i just write to more simple [for me] code... I use "x++" most times only in For wink.gif

 

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
Hello programmers. First, there is my code [copy that and paste into txt file, after that name this "Nevitrotest.cs"]:

 

using System;using System.Windows.Forms;using GTA;namespace Nevitrotest{public class SCRIPT_SPEED_TEST : Script{bool run_test=false;double summarum;int time_run,time_run_limit=10,x,interval=0;int[] getallx = new int[10]; public SCRIPT_SPEED_TEST() {       this.Tick += this.TICK_DO_ALL_TIME; Game.Console.Print("------------------------------\n Nevitro script testing how much time run script with different Interval\n Type 'nvconfig' or 'nvtest'"); BindConsoleCommand("nvtest", new ConsoleCommandDelegate(RUN_TEST)); BindConsoleCommand("nvconfig", new ConsoleCommandDelegate(TEST_CONFIG)); }public void RUN_TEST(ParameterCollection Parameter){Game.Console.Print("Please wait... Test will run in :");Wait(1000);Game.Console.Print("3...");Wait(1000);Game.Console.Print("2..");Wait(1000);Game.Console.Print("1...");Wait(1000);Game.Console.Close();Game.DisplayText("Testing script speed RUN");run_test = true;x=0;time_run=1;summarum=0;GTA.Native.Function.Call("SETTIMERC", 0);}public void TEST_CONFIG(ParameterCollection Parameter){Wait(100);Game.Console.Close();Game.Console.Print("\n------------------INTERVAL CONFIG NEVITRO SCRIPT\n Please, close this console and set interval with UP/DOWN arrows.\n At the end, please press Enter.\n If You do not want change interval, just press Enter after close console\n TIP: Bigger interval will give smaller amount speed of script. \n Scripts should run lees times than normal [interval=0]");Game.DisplayText("How big interval for script You want?");do {Player.CanControlCharacter = false;if (Game.isKeyPressed(Keys.Up)){interval=interval+1;Game.DisplayText("Interval ="+interval);}if (Game.isKeyPressed(Keys.Down)){interval=interval-1;if (interval<0) interval=0;Game.DisplayText("Interval ="+interval);}Wait(20);}while (!(Game.isKeyPressed(Keys.Enter)));Wait(100);Game.Console.Print("\n------------------HOW MUCH TEST CONFIG NEVITRO SCRIPT\n Please, close this console and set how much tests You want with UP/DOWN arrows.\n At the end, please press Enter.\n If You do not want change amount of tests, just press Enter after close console\n Bigger amount mean more accurate results. \n");Game.DisplayText("How much tests You want? for script You want?");do{Player.CanControlCharacter = false;if (Game.isKeyPressed(Keys.Up)){time_run_limit=time_run_limit+1;Game.DisplayText("Amount of tests ="+time_run_limit);}if (Game.isKeyPressed(Keys.Down)){time_run_limit=time_run_limit-1;if (time_run_limit<1) time_run_limit=1;Game.DisplayText("Amount of tests ="+time_run_limit);}Wait(50);}while (!(Game.isKeyPressed(Keys.Enter)));Player.CanControlCharacter = true;Game.Console.Open();Game.Console.Print("Interval of script is "+interval+" ms");Game.Console.Print("Amount tests of script is "+time_run_limit+"\n");Game.Console.Print("Type here 'nvtest'");}   public void TICK_DO_ALL_TIME(object sender, EventArgs e)   { if (run_test==true) { 	if (GTA.Native.Function.Call<int>("TIMERC")<1000) 	{ 	x=x+1; 	Wait(interval); 	} 	else 	{ 	Game.DisplayText("Testing speed ..."); 	getallx[time_run-1]=x; 	Game.Console.Print("Test "+time_run+" run "+x+" times."); 	time_run=time_run+1; 	x=0; 	GTA.Native.Function.Call("SETTIMERC", 0);   if (time_run==(time_run_limit+1))   {   for (int xyz=0; xyz<=9; xyz++)   {   summarum=summarum+getallx[xyz];   }   summarum=summarum/time_run_limit;   run_test=false;   Game.Console.Print("AVG times how much run script: "+Math.Round(summarum,0)+"\nwith interval: "+interval+"\nand with "+time_run_limit+" tests");   Game.DisplayText("Testing script speed STOP");   Game.Console.Open();   } 	} }}}}

 

 

Codes allowed in game console:

"nvconfig"

"nvtest"

 

nvconfig is for set interval and limits tests in game. Interval is it time before script do next loop. Second option, limit of tests, allow to user make very accurace test. Bigger value give more precise results.

 

nvtest - make test. When test run, You can do anything. Also play with others scripts.

 

Instructions:

This scripts generaly is for developers, but also normal user can use this like benchmark for scripts.

If interval is 0 and You have big amount of AVG it is good. If Your AVG amount is under 20 - Your computer must really work hard now. Try to disable some programs in Windows and run again this test. Better? Please write here.

 

Developer on this script, can see what is difference for computer if interval is not set to 1 or 2... Why i say this? Because in GTA 4, many programmist think everyone super computer. Why script must check every milisecond what we do? For me, 10 scripts running and added "this.Interval = 1" make my game run faster... Only 1 ms for every script...

So, with my script You can see in different locations, situations how many loops do script. Your script also should do same amount of loops.

 

I just left for You to fun. Small, fast benchmark wink.gif

 

Forgot, my results [5 AVG for one situation]:

Small window, the lowest graphic, interval 0, place near house: 26, 25, 24,26,25

Fullscreen, medium graphic, interval 0, that same place: 15,16,17,16,16

Fullscreen, medium graphic, interval 1, that same place: 16,16,16,15,14

 

1 loop less, for simple x=x+1 script... what should if You put there some more diffucult things to do? I do not have time for this now, but test for Yourself smile.gif

DateTime start = DateTime.Now;

 

//do stuff

 

DateTime end = DateTime.Now;

 

string Duration = (end - start).seconds.ToString();

?

Link to comment
Share on other sites

 

Hello programmers. First, there is my code [copy that and paste into txt file, after that name this "Nevitrotest.cs"]:

 

using System;using System.Windows.Forms;using GTA;namespace Nevitrotest{public class SCRIPT_SPEED_TEST : Script{bool run_test=false;double summarum;int time_run,time_run_limit=10,x,interval=0;int[] getallx = new int[10]; public SCRIPT_SPEED_TEST() {       this.Tick += this.TICK_DO_ALL_TIME; Game.Console.Print("------------------------------\n Nevitro script testing how much time run script with different Interval\n Type 'nvconfig' or 'nvtest'"); BindConsoleCommand("nvtest", new ConsoleCommandDelegate(RUN_TEST)); BindConsoleCommand("nvconfig", new ConsoleCommandDelegate(TEST_CONFIG)); }public void RUN_TEST(ParameterCollection Parameter){Game.Console.Print("Please wait... Test will run in :");Wait(1000);Game.Console.Print("3...");Wait(1000);Game.Console.Print("2..");Wait(1000);Game.Console.Print("1...");Wait(1000);Game.Console.Close();Game.DisplayText("Testing script speed RUN");run_test = true;x=0;time_run=1;summarum=0;GTA.Native.Function.Call("SETTIMERC", 0);}public void TEST_CONFIG(ParameterCollection Parameter){Wait(100);Game.Console.Close();Game.Console.Print("\n------------------INTERVAL CONFIG NEVITRO SCRIPT\n Please, close this console and set interval with UP/DOWN arrows.\n At the end, please press Enter.\n If You do not want change interval, just press Enter after close console\n TIP: Bigger interval will give smaller amount speed of script. \n Scripts should run lees times than normal [interval=0]");Game.DisplayText("How big interval for script You want?");do {Player.CanControlCharacter = false;if (Game.isKeyPressed(Keys.Up)){interval=interval+1;Game.DisplayText("Interval ="+interval);}if (Game.isKeyPressed(Keys.Down)){interval=interval-1;if (interval<0) interval=0;Game.DisplayText("Interval ="+interval);}Wait(20);}while (!(Game.isKeyPressed(Keys.Enter)));Wait(100);Game.Console.Print("\n------------------HOW MUCH TEST CONFIG NEVITRO SCRIPT\n Please, close this console and set how much tests You want with UP/DOWN arrows.\n At the end, please press Enter.\n If You do not want change amount of tests, just press Enter after close console\n Bigger amount mean more accurate results. \n");Game.DisplayText("How much tests You want? for script You want?");do{Player.CanControlCharacter = false;if (Game.isKeyPressed(Keys.Up)){time_run_limit=time_run_limit+1;Game.DisplayText("Amount of tests ="+time_run_limit);}if (Game.isKeyPressed(Keys.Down)){time_run_limit=time_run_limit-1;if (time_run_limit<1) time_run_limit=1;Game.DisplayText("Amount of tests ="+time_run_limit);}Wait(50);}while (!(Game.isKeyPressed(Keys.Enter)));Player.CanControlCharacter = true;Game.Console.Open();Game.Console.Print("Interval of script is "+interval+" ms");Game.Console.Print("Amount tests of script is "+time_run_limit+"\n");Game.Console.Print("Type here 'nvtest'");}   public void TICK_DO_ALL_TIME(object sender, EventArgs e)   { if (run_test==true) { 	if (GTA.Native.Function.Call<int>("TIMERC")<1000) 	{ 	x=x+1; 	Wait(interval); 	} 	else 	{ 	Game.DisplayText("Testing speed ..."); 	getallx[time_run-1]=x; 	Game.Console.Print("Test "+time_run+" run "+x+" times."); 	time_run=time_run+1; 	x=0; 	GTA.Native.Function.Call("SETTIMERC", 0);   if (time_run==(time_run_limit+1))   {   for (int xyz=0; xyz<=9; xyz++)   {   summarum=summarum+getallx[xyz];   }   summarum=summarum/time_run_limit;   run_test=false;   Game.Console.Print("AVG times how much run script: "+Math.Round(summarum,0)+"\nwith interval: "+interval+"\nand with "+time_run_limit+" tests");   Game.DisplayText("Testing script speed STOP");   Game.Console.Open();   } 	} }}}}

 

 

Codes allowed in game console:

"nvconfig"

"nvtest"

 

nvconfig is for set interval and limits tests in game. Interval is it time before script do next loop. Second option, limit of tests, allow to user make very accurace test. Bigger value give more precise results.

 

nvtest - make test. When test run, You can do anything. Also play with others scripts.

 

Instructions:

This scripts generaly is for developers, but also normal user can use this like benchmark for scripts.

If interval is 0 and You have big amount of AVG it is good. If Your  AVG amount is under 20 - Your computer must really work hard now. Try to disable some programs in Windows and run again this test. Better? Please write here.

 

Developer on this script, can see what is difference for computer if interval is not set to 1 or 2... Why i say this? Because in GTA 4, many programmist think everyone super computer. Why script must check every milisecond what we do? For me, 10 scripts running and added "this.Interval = 1" make my game run faster... Only 1 ms for every script...

So, with my script You can see in different locations, situations how many loops do script. Your script also should do same amount of loops.

 

I just left for You to fun. Small, fast benchmark wink.gif

 

Forgot, my results [5 AVG for one situation]:

Small window, the lowest graphic, interval 0, place near house: 26, 25, 24,26,25

Fullscreen, medium graphic, interval 0, that same place: 15,16,17,16,16

Fullscreen, medium graphic, interval 1, that same place: 16,16,16,15,14

 

1 loop less, for simple x=x+1 script... what should if You put there some more diffucult things to do? I do not have time for this now, but test for Yourself smile.gif

DateTime start = DateTime.Now;

 

//do stuff

 

DateTime end = DateTime.Now;

 

string Duration = (end - start).seconds.ToString();

?

Actually:

 

using System.Diagnostics;Stopwatch sw = new Stopwatch();sw.Start();... do your stuff ...sw.Stop();TimeSpan executionTime = sw.Elapsed;

 

 

It's the suggested way by Microsoft. It should have negligible delay. And, just to remind, you should make multiple benchmarks.

 

http://msdn.microsoft.com/en-us/library/sy....stopwatch.aspx

Edited by pedro2555
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.