Groups | Blog | Home
all groups > inetserver asp general > november 2003 >

inetserver asp general : & vs. <%=


Dave Holmes
11/3/2003 11:30:26 AM
I am working with some third-party ASP code.

Rather than:

<%
if x then
response.write "<b>" & var1 & "," & var2 & "," & var3 & "</b>"
end if
%>

it is more likely to contain:

<%
if x then
%>
<b><%=var1>,<%=var2>,<%=var3>,</b>
<%
end if
%>

I know that concatenation is expensive, but so is switching back and
forth from ASP to HTML. Does anyone have any hard data as to which is
more resource-intensive?

Thanks

Aaron Bertrand - MVP
11/3/2003 12:56:00 PM
You could run a test in your environment!

Context switching is much less expensive now (IIS 5/6) than it was in the
IIS 4 days.

I prefer

response.write "<b>"
response.write "var1"
response.write ","

etc.

I find it easier to read than intermingling, and less of a bear than
concatenation. YMMV.





[quoted text, click to view]

AddThis Social Bookmark Button