SA-MP Forums Archive
bigger gamemode more CPU? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: bigger gamemode more CPU? (/showthread.php?tid=123051)



bigger gamemode more CPU? - Sampiscool123 - 24.01.2010

the bigger the game mode the more CPU it will use? if so how big would it have to be to use to much?


Re: bigger gamemode more CPU? - HydraX - 24.01.2010

Depending how much Timers you use.


Re: bigger gamemode more CPU? - Sampiscool123 - 24.01.2010

is 5 timers ok?


Re: bigger gamemode more CPU? - RoBo - 24.01.2010

The number of timers doesn't matter. A bigger gamemode would only use more RAM, not CPU (as pawn is single threaded).


Re: bigger gamemode more CPU? - Correlli - 24.01.2010

Quote:
Originally Posted by Sampiscool123
the bigger the game mode the more CPU it will use? if so how big would it have to be to use to much?
Quote:
Originally Posted by Sampiscool123
is 5 timers ok?
What are you actually trying to do? Screw up your server?


Re: bigger gamemode more CPU? - RoBo - 24.01.2010

Quote:
Originally Posted by Don Correlli
What are you actually trying to do? Screw up your server?
There's nothing wrong with having 5 timers... you could have 50 and there still wouldn't be any problems.


Re: bigger gamemode more CPU? - Correlli - 24.01.2010

Quote:
Originally Posted by RoBo
There's nothing wrong with having 5 timers...
I haven't said anything against timers. Check his first post and maybe you'll get the point.

Quote:
Originally Posted by RoBo
you could have 50 and there still wouldn't be any problems.
Indeed, if the interval is big enough.


Re: bigger gamemode more CPU? - Sampiscool123 - 24.01.2010

does more objects mean more CPU?


Re: bigger gamemode more CPU? - Woet - 25.01.2010

CPU usage is caused by processing data, not by objects, timers etc.
Please read http://forum.sa-mp.com/index.php?topic=79810.0 for ways to lower CPU usage.
And be sure that your OnPlayerUpdate is very optimized because any code in there gets called hundreds of times a second.


Re: bigger gamemode more CPU? - iLinx - 25.01.2010

In short - each time you do something on your server it takes up some ticks from the cpu.
For example, an if statement, a for loop, writing to a file, etc, will use up CPU.

Generally in SA-MP most CPU usage is generated by players (commands, etc)
Example - lets say you have 100 commands that use the standard 'strcmp' method in your script, thats ~100 boolean expressions that the script may potentially need to cycle through each time you enter a command (depending on where the command is in the callback ofc).