Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performance Question 2

Status
Not open for further replies.

RushiShroff

Programmer
Jan 23, 2002
216
IN
What are the major benefits of using Response.write for even
printing HTML syntax ?
As ASP offers as its best advantage,I generally seperate HTML with ASP clearly.
That means when i can use HTML,I strictly use it.
Only for serverside scripting,I use ASP ?

Any performance problem if i follow this practice ?
(As it comprises more <%%> tags)

Regards,
rushi@emqube.com
 
I have in the past tripped my self up using HTML and ASP mixed... theres no reason why you cant use both, i use sub functions to put HTML into

Sub Header
%>
<html>
etc...

</body>
<%
End Sub

Sub Footer
%>
</body>
</html>
<%
End Sub Regards gsc1ugs
&quot;Cant see wood for tree's...!&quot;
 
Here's a simple heuristic:

The less <%%>'s, the better.

Think of those as light switches. ON - OFF

The more times you use them, the more times you are flipping that switch, and the slower your application will run.

response.write()ing HTML to the browser is a perfectly efficient solution, and much more preferrable than

<%
some script
%>
<someHTML>
<%
some more script
%>
<someMoreHTML>

Will the above code result in an application that won't function? No. It'll function... albeit slower than a solution without all the script tags. It'll also make your ASP pages much more readable. You can even cause the html source to have a line break if you like by concatenating the vbcr on the end of a response.write()

with response
.write(&quot;<table>&quot; & vbcr)
.write(&quot;<tr><td>Here's some stuff</td></tr>&quot; & vbcr)
.write(&quot;</table>&quot;)
end with

will come out looking like:

<table>
<tr><td>Here's some stuff</td></tr>
</table>

when you &quot;View Source&quot; from your HTML page, which will make tracking down the rogue syntax error a little easier on you.

hope that clears it up a bit. :)
paul
penny1.gif
penny1.gif
 
Thanks Link9,you really desearves to be the Top Expert of this forum.
Well one more thing I like to know that after going through
all coding tips given at msdn.microsoft.com/workshop,also by top technologists at various asp article sites and book authors,it seems as IF I STRICTLY (TRY TO) FOLLOW THIS
STANDARDS,MAYBE I AM NOT ABLE TO CODE AS A NATURAL WAY OR TO BE MORE RASH & REALISTIC,I CAN NOT CODE EVEN.

Some expert says concatenation is a problem,avoid using that.But places where i have to use tham,I cant avoid them.
Now if I put all my client side code into response.write ,
can you imagine how long it will take to complete the code ..??

What i want to ask is where all these ends ? There has be a threshold point where the quality standards should balance with natural coding ..

Hope can you understand this..
Regards,
Rushi@emqube.com

 
I read a whitepaper on asptoday (before they became a pay site) one time that said

Response.write &quot;some string&quot; & _
&quot;another string&quot; & _
&quot;last string&quot;

is faster than:
with response
.write &quot;somestring&quot;
.write &quot;another string&quot;
.write &quot;last string&quot;
end with

because you only make one function call.

hth leo

------------
Leo Mendoza
lmendoza@garbersoft.net
 
ASPs are &quot;compiled&quot; into a cache. You can not use <% or %> anywhere in your code except as delimiters. You can not use them in literals because ASP does not parse the code while scanning for them. It breaks the page up fast by a serial scan for <% %> where ever they are. It may take longer to find and interpret a bunch of Response.Writes for the HTML than it does to create them after scanning. If you have 40 lines of HTML between %> and the next <%, only one internal response.write need be created rather than interpretting the ones you would create, which for readiblility sake would probably be much higher than one.

Compare Code (Text)
Generate Sort in VB or VBScript
 
We have discussed quite a bit on the response object's write method and performance.

Can somebody has a chart-pie or % wise imporatnce of performance factors ?
Because sometimes what happens we take care of small small things but make mistake at much imp aspect.

As for example,
30% performance goes to -->> Database design and SQL structure
15 % -->> How you open,use and close the ADO conection
10 % -->> if you use Session,Application variables or Not

This is just an idea if you have worked etensively on performance issue,please try to make priority chart.

Regards,
Rushi@emqube.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top