SA-MP Forums Archive
Arrays vs Single variables - 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: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Arrays vs Single variables (/showthread.php?tid=455191)



Arrays vs Single variables - kurta999 - 31.07.2013

I've readed lot of about this, and I saw someone said arrays are slower than normal single variables, someone not.

What's your opinion?


Re: Arrays vs Single variables - Jay_ - 31.07.2013

What you're suggesting cannot be justified without any relevant theory to back it up. You need to elaborate.


Re: Arrays vs Single variables - MP2 - 01.08.2013

Quote:
Originally Posted by kurta999
View Post
I've readed lot of about this, and I saw someone said arrays are slower than normal single variables, someone not.

What's your opinion?
This is (or is not, I don't actually know) a fact, the complete opposite of an opinion. I don't really see any discussion to be had here \o


Re: Arrays vs Single variables - Mauzen - 01.08.2013

Id rather say, arrays are only slower than single variables, if you misuse them. E.g. by making them bigger than needed.
Technically, arrays are nothing else but normal variables, pointers to a position in memory. Arrays just got an additinal rule that defines the offset from the position for array indexes. Reading and writing to these memory addresses always have the same speed.


Re: Arrays vs Single variables - Scenario - 01.08.2013

I'm going to agree with Mauzen on this one!