Which one is faster?
#1

Hi guys, I have two ways to use timer:
1. ptask
PHP код:
ptask UpdateTime[10000](playerid)
{
    new 
time0time1time2;
    
gettime(time0time1time2);
    
SetPlayerTime(playeridtime0time1);
    return 
1;

2. task with foreach loop
PHP код:
task UpdateTime[10000]()
{
    foreach(new 
iPlayer)
    {
        new 
time0time1time2;
        
gettime(time0time1time2);
        
SetPlayerTime(playeridtime0time1);
    }
    return 
1;

I wanna know which one is faster to use, please help me. Thank you!
Reply
#2

Foreach
Reply
#3

ptask is certainly prettier.


I am sure there is not such a big performance difference between the two, otherwise ****** would have noted that it ptask is slower, but prettier.
Reply
#4

Thanks guys. But when I use the ptask way, it gives me error:
Quote:

array sizes do not match, or destination array is too small

at this line:
Quote:

ptask UpdateTime[10000](playerid)

Can someone help me with this? Thank you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)