SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion

Reply
 
Thread Tools Display Modes
Old 18/02/2018, 03:07 PM   #11
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,714
Reputation: 3068
Default Re: Code optimisations

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!
Y_Less is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[solved]Converting my old Mysql code to new mysql code.. Darrenr Scripting Help 1 22/03/2015 03:05 PM
How to make when using pawno and type part of the code, to show the full code ? bustern Scripting Help 10 28/08/2013 09:10 AM
[Tool/Web/Other] Code Highlighter - Highlight code to find brackets, organize code, ... Sinner Tools and Files 8 09/03/2012 01:28 PM
Get ride of wepons on Spawn code | need code cssbart Help Archive 5 19/04/2010 06:05 PM


All times are GMT. The time now is 08:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.