I have included two pseudo-code examples below. The first shows me
allocating memory via a variable and using it repeatedly. The second
shows me taking the "direct route" to the data.
For a web application performing multiple operations in a short amount
of time, which procedure would maximize speed on the server? (Is it
better to use a variable? Is it best to use the "direct route"? Or is
it a moot point because they both use the same resources to get where
they need to go anyway?)
Please note that I am looking for answers *ONLY* pertaining to server
speed and resources. I understand that variables are "easier" for a
programmer to use, but I want to know what makes the server run
smoother.
Thanks in advance!
EXAMPLE 1:
(coll1 is a collection of directory strings...)
Dim temp as String = New IO.DirectoryInfo(coll1.Item(i)).name
if InStr(temp, "xyz") then...
if temp = "xyz123" then...
if Right(temp, 3) = "123" then...
EXAMPLE 2:
(coll1 is a collection of directory strings...)
if InStr(New IO.DirectoryInfo(coll1.Item(i)).name, "xyz") then...
if New IO.DirectoryInfo(coll1.Item(i)).name = "xyz123" then...
if Right(New IO.DirectoryInfo(coll1.Item(i)).name, 3) = "123" then...