& vs. <%=

D

Dave Holmes

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
 
A

Aaron Bertrand - MVP

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top