SA-MP Forums Archive
Are macros faster than stocks? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Are macros faster than stocks? (/showthread.php?tid=185066)



Are macros faster than stocks? - Whizion - 23.10.2010

The question in the title, thanks.


Re: Are macros faster than stocks? - Calgon - 23.10.2010

If you create a macro, during complication, the code in the macro (if called) replaces the macro name/title. Basically:

pawn Код:
#define       take_control(%0, %1)         printf("lol, %s %s", %0, %1) // Probably a bad example        

public OnGameModeInit() {
take_control("foo", "bar");
}
would result in the code in OnGameModeInit becoming:

pawn Код:
printf("lol, %s %s", "foo", "bar");
Seeing as the PAWN speed order is as followed:

Quote:
Originally Posted by ******
Nothing
Constants
Variables
Arrays
Native functions
Custom functions
Remote functions
stocks (being custom functions) would be slower. Though Macros are intended for use of small snippets of code, not huge functions.


Re: Are macros faster than stocks? - Whizion - 23.10.2010

Thanks for the info.