|
 |
asp_discuss thread: Which is faster?
Message #1 by gbrown@c... on Thu, 1 Nov 2001 16:09:42
|
|
Hi all
I'm looking at optimising my code and read somewhere that what I am doing
is slow. My code currently does
<%
' do some server processing
%>
html tags
<%
' more server processing
%>
and so on.
The post I saw previously said to leave code inside <% %> as much as
possible and use response.write.
I understand the difference between server and client side (!?!) but what
sort of hit am I looking at by swapping in and out of <%%>. I thought that
html stuff gets rendered at the same time so there is no hit.
Any comments gratefully received
Regards
Graham
Message #2 by "Steven A Smith" <ssmith@a...> on Thu, 1 Nov 2001 21:55:58 -0500
|
|
It's called context switching, and it's a hit because two different
processes are used when the page is interpreted -- one for ASP and one for
HTML. Switching back and forth between them during the interpretation of
the page slows things down. Don't worry about it TOO much -- it's really
only a major bottleneck if you do it in a big loop. Otherwise you're
looking at <1% gains in performance.
However, it IS a good idea to try and keep all of your ASP code in once
section of the page, to avoid spaghetti code and make it easier to break the
code up into functions, COM objects, or .NET code in the future.
Steve
Steven Smith
ssmith@a...
President, ASPAlliance.com
http://aspalliance.com The #1 ASP.NET Community
http://aspsmith.com ASP.NET Training for ASP Developers
Get The Book: ASP.NET By Example
http://www.amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: <gbrown@c...>
To: "asp_discuss" <asp_discuss@p...>
Sent: Thursday, November 01, 2001 11:23 AM
Subject: [asp_discuss] Which is faster?
> Hi all
>
> I'm looking at optimising my code and read somewhere that what I am doing
> is slow. My code currently does
>
> <%
> ' do some server processing
> %>
> html tags
> <%
> ' more server processing
> %>
>
> and so on.
>
> The post I saw previously said to leave code inside <% %> as much as
> possible and use response.write.
>
> I understand the difference between server and client side (!?!) but what
> sort of hit am I looking at by swapping in and out of <%%>. I thought that
> html stuff gets rendered at the same time so there is no hit.
>
> Any comments gratefully received
>
> Regards
> Graham
>
>
$subst('Email.Unsub')
>
>
|
|
 |