06.09.2015, 18:37
Hi,
I'm actually quite happy to see that someone decides to optimize his GameMode
The general rules of thumb are:
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.
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.
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.