stock and the public which is faster?
#1

stock and the public which is faster?
Reply
#2

You mean function? They will most certainly take about the same amount of time to be called and executed, but why don't you benchmark it yourself?

TIP: If you don't need to call function in your GM from a filterscript or by timer, use stock.
Reply
#3

Unless the function needs to be called by a timer or something that requires public, I'd stay with using stock.
Reply
#4

Quote:
Originally Posted by mick88
Посмотреть сообщение
You mean function? They will most certainly take about the same amount of time to be called and executed, but why don't you benchmark it yourself?

TIP: If you don't need to call function in your GM from a filterscript or by timer, use stock.
I need to be frequently used function so which one? And you can teach me how to benchmark it?
Reply
#5

You don't pick a function header ( I think that is what it is called ) based on how fast you want it to be, you take into account..

1. stock: the compiler will ignore the function if it is not called
2. public: will the function be called by a timer, or called remotely from a filterscript.

if your answer to 2 is no, and you are using the function often, I think you can just define the function like this.
pawn Код:
MyFunction(playerid,whatever)
{
     // stuff
     return 1;
}
There may be other criteria for the decision, but I have never heard of speed of execution being one of them.
Reply
#6

I don't use a function header unless the function is in an include file or required for CallRemoteFunction or a timer.

http://pastebin.com/ZNDB2tVg

I only ran one test, but here are the results.

Код:
[00:48:51] n/a 9340
[00:49:01] stock 9500
[00:49:10] public 9897
Reminder; that is 50 million loops, so there is literally no practical speed difference.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)