SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 26/05/2018, 10:24 PM   #11
dali123
Little Clucker
 
Join Date: Oct 2017
Location: Tunisia
Posts: 6
Reputation: 0
Default Re: Faster pwn compiler

There is not way to compile your pawn file faster than your current time unless you buys a new computer with better ram, try using less 'Functions' and use 'OnPlayerUpdate' . . .
dali123 is offline   Reply With Quote
Old 27/05/2018, 12:26 AM   #12
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,791
Reputation: 3108
Default Re: Faster pwn compiler

Are you aware you just bumped a 4 year old topic with totally incorrect information? Since this topic died, a new compiler fork has been very actively worked on, and made much much faster.
Y_Less is offline   Reply With Quote
Old 27/05/2018, 01:06 AM   #13
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Location: KS.
Posts: 776
Reputation: 134
Exclamation Re: Faster pwn compiler

Quote:
Originally Posted by dali123 View Post
There is not way to compile your pawn file faster than your current time unless you buys a new computer with better ram, try using less 'Functions' and use 'OnPlayerUpdate' . . .
bought a new computer, compiling much faster, thanks!!
cuber is offline   Reply With Quote
Old 01/06/2018, 12:20 PM   #14
Sasino97
High-roller
 
Sasino97's Avatar
 
Join Date: Dec 2010
Location: Italy
Posts: 1,436
Reputation: 102
Default Re: Faster pwn compiler

Since this has already been bumped, I would like to add an advice to improve slightly the compilation time: remove from your script all the things that can be loaded at runtime, such as the DynamicObjects.
For example if you have a block of code that looks like this
Code:
CreateDynamicObject(214, 2140.024, 2140.02, 242.22, 4.42, 340.3, 34.0);
CreateDynamicObject(214, 2140.024, 2140.02, 242.22, 4.42, 340.3, 34.0);
CreateDynamicObject(214, 2140.024, 2140.02, 242.22, 4.42, 340.3, 34.0);
[...]
You can simply move all these lines to an external text file, remove "CreateDynamicObject(" and ");" with Find+Replace and load the file using fread and sscanf.
Code:
while(fread(file, line))
{
    if(sscanf(line, "iffffff", model, x, y, z, rx, ry, rz))
        continue;
    CreateDynamicObject(model, x, y, z, rx, ry, rz);
}
Sasino97 is online now   Reply With Quote
Old 08/06/2018, 06:21 PM   #15
AmigaBlizzard
Huge Clucker
 
Join Date: Jul 2012
Posts: 309
Reputation: 57
Default Re: Faster pwn compiler

Also huge switch case statements bring alot of compile-time:
Code:
	switch (somevar)
	{
		case 0 .. 4999:
		{
			// Do something
		}
		case 5000 .. 9999:
		{
			// Do something
		}
		case 10000 .. 14999:
		{
			// Do something
		}
	}
This code in a blank script will lead to huge compile times already.
It's not only the length of the script that matters, it's also the way it's written.

Code:
if (0 <= somevar <= 4999)
	// Do something
if (5000 <= somevar <= 9999)
	// Do something
if (10000 <= somevar <= 14999)
	// Do something
Changing it to this does the exact same thing, but will make compile time alot faster again.

The huge switch statement made the compiler generate a separate if-statement for every value, so it was in fact creating 15000 if-statements.
Not to mention that would generate a massive AMX file as well.
AmigaBlizzard 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
PAWN Compiler Error Unable to execute Compiler.. Geeboi_Mehdi General 13 07/11/2015 04:26 PM
Please help ( PAWN Compiler "Error Unable to execute Compiler...") morocco Scripting Help 4 05/02/2013 03:34 PM
Which is more faster? Fernado Samuel Scripting Help 19 18/01/2013 03:56 PM
Which is faster ? cotyzor Scripting Help 1 14/01/2013 06:30 AM
[Pawno Compiler] Unable to Execute the Compiler Fabio11 Client Support 6 26/09/2010 09:37 PM


All times are GMT. The time now is 12:00 PM.


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