Optimizing a gamemode
#2

Hi,

I'm actually quite happy to see that someone decides to optimize his GameMode

The general rules of thumb are:
  • For commands, use a ZCMD like command processor instead of the traditional strcmp
  • Don't create variables with a "generic size", that is like "new string[255];", most of the times you're basically eating memory space without reason. If you are going to store the string "Hello World", use "new string [12];" (11 characters + 1 for the NUL terminator). This might help you:
    http://www.kayj.ml/media/String%20Checker.php
    You can create variables with the "Recommended block size", creating a variable with 12 characters or 16 would use the same memory space.
Once you feel more geeky, feel free to to read this thread:
https://sampforum.blast.hk/showthread.php?tid=580289

Also, this is not directly related to optimization, but make sure to use the plugin CrashDetect to troubleshoot errors more easily! You would be in fact optimizing your time

At last but not least, do optimizations but make sure it doesn't affect your productivity. If your code is already optimized, don't optimize it even more, because the performance gain would not be noticeable at an human scale. You get what I mean? Optimizing something to run 5 or 10 microseconds faster is what I call "overoptimization", when you could be doing something more productive.
Reply


Messages In This Thread
Optimizing a gamemode - by Stev - 06.09.2015, 14:09
Re: Optimizing a gamemode - by Nixtren - 06.09.2015, 18:37
Re: Optimizing a gamemode - by Stev - 06.09.2015, 20:51
Re: Optimizing a gamemode - by Nixtren - 06.09.2015, 21:13
Re: Optimizing a gamemode - by Stev - 06.09.2015, 21:16

Forum Jump:


Users browsing this thread: 1 Guest(s)