I was pondering over a question with regards to the speeds of reading something and did not see this kind of question in a forum search.
The question: What is (technically) faster? Multiple reads from the same 3d array cell, or only once make a 'temp' variable from that cell and read the value from this? I don't know if either has any real impact at all anyway, but just wanted to ask anyway. :-)
There may be a difference if the value holds an integer or a string (or something else) but in my case, is a simple integer.
To hopefully clarify with a small bit of code:
$process = $start - 15
If $xy[$process] <> "x" Then
If _ArraySearch($open, $process, 1, $open, 0, 0, 1, 1) <> -1 Then
ElseIf $start > 0 And _ArraySearch($closed, $process, 1, $closed, 0, 0, 1, 0) = -1 Then
Add_open($start, $closed, $counter, $process)
You can read from this, that the array $closed is being read 3 times. And this goes on further in the code I did not show.
My question boils down to this, should I make a 'temp' variable to hold that $closed value until the function is done?
It may not have a real impact on my small script, but I really am interested in the answer at least.