What's faster ? Arrays or Foreach
#1

Hey guys, I have read once a thread that a regular variable will always be faster than an array, which actually makes sense (it was explained with an Assembly example).
I have seen in other thread that native & inbuilt functions will always be faster than PAWN scripted functions, something with the compile progress or something.
So basically, what could be actually faster ?
PHP код:
if(!Iter_Contains(Adminsplayerid)) 
or
PHP код:
if(!PlayerInfo[playerid][pAdmin]) 
Reply
#2

It depends on what you're actually trying to do.

Having an 'Admins' iterator will make it much faster to loop through the online admins.
While using the second one is usually used to save stats (Enum), so creating an iterator for every stat you wanna save is a very bad idea.
Reply
#3

Use both, iterator to loop and the array to check admin level.
Reply
#4

Quote:
Originally Posted by Stinged
Посмотреть сообщение
It depends on what you're actually trying to do.

Having an 'Admins' iterator will make it much faster to loop through the online admins.
While using the second one is usually used to save stats (Enum), so creating an iterator for every stat you wanna save is a very bad idea.
Thanks.

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Use both, iterator to loop and the array to check admin level.
Exactly what I am doing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)