18.02.2018, 15:07
I just want to say that a lot of the information in this topic is now obsolete. The general approach to optimisation is:
1) Just write your code, try make it good, but don't waste time making it excellent. A lot of these tips sacrifice readability for TINY improvements you will never notice.
2) If you actually notice some code running slowly, profile it with the profiler plugin. That will tell you exactly what code is truly running slowly.
3) Once you know which part is slow, you can improve the ALGORITHMS! You could write a bubble sort in hand-optimised x86 assembly, but it will still be beaten by a PAWN version of quicksort, because quicksort is just a better way of doing things!
4) Only then should you use the tips listed here to get the most out of the worst offending pieces of code.
You could spend hours making a function 50% faster, but if it is only called once an hour it doesn't matter. On the other hand, if you determine that another function is called 50 times a second, then just a 0.5% improvement will be far more useful!
1) Just write your code, try make it good, but don't waste time making it excellent. A lot of these tips sacrifice readability for TINY improvements you will never notice.
2) If you actually notice some code running slowly, profile it with the profiler plugin. That will tell you exactly what code is truly running slowly.
3) Once you know which part is slow, you can improve the ALGORITHMS! You could write a bubble sort in hand-optimised x86 assembly, but it will still be beaten by a PAWN version of quicksort, because quicksort is just a better way of doing things!
4) Only then should you use the tips listed here to get the most out of the worst offending pieces of code.
You could spend hours making a function 50% faster, but if it is only called once an hour it doesn't matter. On the other hand, if you determine that another function is called 50 times a second, then just a 0.5% improvement will be far more useful!