I'd like some expert opinions on the performance difference between these three ways of writing code.
Because of the extra calls to the server would there be a noticable speed difference or not?
I use #1 but we have a programmer that uses #2. His programs run real slow and I was wondering if all the calls to the server is part of the problem.
I also see where #3 is probably faster yet though I haven't ever wrote that way.
Thanks for your help.
#1.
<%
If Not objRs.EOF And Not objRs.BOF Then
While not objRs.Eof %>
<TR><TD><%= objRs.Fields(1).value %></TD></TR>
<TR><TD><%= objRs.Fields(2).value %></TD></TR>
<TR><TD><%= objRs.Fields(3).value %></TD></TR>
<TR><TD><%= objRs.Fields(4).value %></TD></TR>
<% obRs.moveNext
Wend
else
...
#2.
<% If Not objRs.EOF And Not objRs.BOF Then %>
<%While not objRs.Eof %>
<TR><TD><%= objRs.Fields(1).value %></TD></TR>
<TR><TD><%= objRs.Fields(2).value %></TD></TR>
<TR><TD><%= objRs.Fields(3).value %></TD></TR>
<TR><TD><%= objRs.Fields(4).value %></TD></TR>
<% obRs.moveNext%>
<%Wend%>
<%else%>
...
#3.
<%
If Not objRs.EOF And Not objRs.BOF Then
While not objRs.Eof
Response.Write "<TR><TD>" & objRs.Fields(1).value & "</TD></TR>" & vbcrlf & _
"<TR><TD>" & objRs.Fields(2).value & "</TD></TR>" & vbcrlf & _
"<TR><TD>" & objRs.Fields(3).value & "</TD></TR>" & vbcrlf & _
"<TR><TD>" & objRs.Fields(4).value & "</TD></TR>" & vbcrlf
objRs.moveNext
Wend
else
...
Because of the extra calls to the server would there be a noticable speed difference or not?
I use #1 but we have a programmer that uses #2. His programs run real slow and I was wondering if all the calls to the server is part of the problem.
I also see where #3 is probably faster yet though I haven't ever wrote that way.
Thanks for your help.
#1.
<%
If Not objRs.EOF And Not objRs.BOF Then
While not objRs.Eof %>
<TR><TD><%= objRs.Fields(1).value %></TD></TR>
<TR><TD><%= objRs.Fields(2).value %></TD></TR>
<TR><TD><%= objRs.Fields(3).value %></TD></TR>
<TR><TD><%= objRs.Fields(4).value %></TD></TR>
<% obRs.moveNext
Wend
else
...
#2.
<% If Not objRs.EOF And Not objRs.BOF Then %>
<%While not objRs.Eof %>
<TR><TD><%= objRs.Fields(1).value %></TD></TR>
<TR><TD><%= objRs.Fields(2).value %></TD></TR>
<TR><TD><%= objRs.Fields(3).value %></TD></TR>
<TR><TD><%= objRs.Fields(4).value %></TD></TR>
<% obRs.moveNext%>
<%Wend%>
<%else%>
...
#3.
<%
If Not objRs.EOF And Not objRs.BOF Then
While not objRs.Eof
Response.Write "<TR><TD>" & objRs.Fields(1).value & "</TD></TR>" & vbcrlf & _
"<TR><TD>" & objRs.Fields(2).value & "</TD></TR>" & vbcrlf & _
"<TR><TD>" & objRs.Fields(3).value & "</TD></TR>" & vbcrlf & _
"<TR><TD>" & objRs.Fields(4).value & "</TD></TR>" & vbcrlf
objRs.moveNext
Wend
else
...