473,804 Members | 3,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP Performance

I've read numerous articles, more than I can count, on ASP performance. I
see conflicting information so I did some tests on my own.

getstring and getrows are actually faster than recordset looping.

However, I've read in looping that Do While...Loop is the fastest and
For...Next the slowest but my tests prove otherwise.

I've tested:
Do...Loop
Do While...Loop
Do Until...Loop
While...Wend
For...Next

I didn't think I could do an accurate test with For...Each unless I used a
collection or an array.

I also see conflicting information on string concatenation and
Response.Write

Is this better?

dim str
str = str & "this "
str = str & "that "
str = str & "this and that"
Response.Write str

or this?

dim str
Response.Write "this "
Response.Write "that "
Response.Write "this and that"

I've also seen to speed the last one up:

with Response
.Write "this "
.Write "that "
.Write "this and that"
end with

Are there reliable performance tests that can be reviewed?
Does it vary between languages? ASP:VBscript, ASP:JScript, C/C++, Delphi,
VB, C#

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05
31 2244
Why not use something like the code below to set row style:
No Mod Check or any heavy processing code needed.

Function GetRowStyle(str 1)

Select Case str1
Case "Style1"
GetRowStyle = "Style2"
Case Else
GetRowStyle = "Style1"
End Select
End Function
PS. The Getrows() is the way to go with the data.

'dlbjr
'Pleading sagacious indoctrination!
Jul 22 '05 #21
"Roland Hall" wrote:
You saying, in that thread that this:

dim arr
arr = Array("A","B"," C")

is significantly better than...

dim arr
arr = split("A,B,C"," ,")

Where is the threshold where it becomes noticeable?


This is not an ASP question.


It's being used on a web page with a .asp extension between
<% and %>. What would you label it?


VBScript, obviously.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #22
"Roland Hall" wrote:
No, because that just leads to more analysis. What if you flush the
buffer after every write? How about after every Nth write? Tedious.
My goodness Dave. Obviously I'm not wanting to double processing in
hopes of decreasing latency. However, perhaps there is a potential
for an increase in performance by flusing the buffer every now and
then. Saying it's not worth considering because it requires more
analysis dosen't seem like a worthwhile response.


By "tedious", I was referring to doing more analysis. You asked if I
happened to do that analysis, and my answer was: "No, because that would
require a lot more than a single simple observation."

I don't really see what your beef is.
...How can I take adavantage of getRows with iteration where I want
cosmetic differences in the results...


...If is use getrows and want every other background a different color,
I have use a MOD or something to determine which will have a negative
impact on the advantage of using getrows.


It seems you already know the answer to your question.

...I'm still using For...Next loops, which will require a decision to
determine which row is which...


Does it really? Here's an alternative with no "decision":

<style>
tr.row0 { background-color:#fff }
tr.row1 { background-color:#eee }
</style>
<% for (i=0; i<ary.length; i++) { %>
<tr class="row<%=i% 2%>"> ...

Here's another:

<% var colors=["#fff","#ee e"]
for (i=0; i<ary.length; i++) { %>
<tr stlye="backgrou nd-color:<%=colors[i%2]%>"> ...
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #23
It is best to use tags as such in asp:

<script language="VBScr ipt" runat="Server">

</script>

<script language="javas cript" runat="Server">

</script>

This allows a mixed use (if needed) of multiple languages on as single page.
No dependency on the Default Language setting in IIS.
Assuming the server is set to VBScript is a false assumption.
Moving pages from one server to another can fail.

Using Tags as such:

<% %>

Assumes the default language is set to what you are using.
You should at least clarify the language at the top of the asp.

'dlbjr
'Pleading sagacious indoctrination!
Jul 22 '05 #24
"Bob Barrows [MVP]" wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
: Roland Hall wrote:
: >
: > If is use getrows and want every other background a different color,
: > I have use a MOD or something to determine which will have a negative
: > impact on the advantage of using getrows.
:
: But it still beats the alternative of looping through your recordset.

Yes, I would agree. I read a document that says getrows sometimes,
getstring sometimes AND recordset loops sometimes but not sure where I read
it. It was either aspfaqs.com or 4guysfromrolla. com, which I think is run
by the same people.

Would you agree that recordset loops can be used sometimes?

: > At this point getstring
: > seems to have a disadvantage since it uses markup as parameters.
: > There is nothing that says, use all even or all odd rows with
: > different markup.
: >
: > If the comparison is only for a drab layout, then it's not that
: > realistic except perhaps to an accountant. I'm still using
: > For...Next loops, which will require a decision to determine which
: > row is which unless you use alternating loops separating odd and even
: > and that seems to be bad alternative.
:
:
: Or you could incorporate some of that logic into the query that produces
the
: resultset.
: Perhaps a computed column that indicates the color to be used for a row
....

A computer column that returns a hex value?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #25
"dlbjr" wrote in message news:Ok******** ******@tk2msftn gp13.phx.gbl...
: Why not use something like the code below to set row style:
: No Mod Check or any heavy processing code needed.

But it's still a decision tree, is it not? Does SELECT...CASE perform
better than IF...THEN?

: Function GetRowStyle(str 1)
:
: Select Case str1
: Case "Style1"
: GetRowStyle = "Style2"
: Case Else
: GetRowStyle = "Style1"
: End Select
: End Function
:
:
: PS. The Getrows() is the way to go with the data.

As a primary or a constant solution? I'm trying to narrow down and document
what will perform best for a given situation.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #26
"Dave Anderson" wrote in message news:11******** *****@corp.supe rnews.com...
: "Roland Hall" wrote:
: >> No, because that just leads to more analysis. What if you flush the
: >> buffer after every write? How about after every Nth write? Tedious.
: >
: > My goodness Dave. Obviously I'm not wanting to double processing in
: > hopes of decreasing latency. However, perhaps there is a potential
: > for an increase in performance by flusing the buffer every now and
: > then. Saying it's not worth considering because it requires more
: > analysis dosen't seem like a worthwhile response.
:
: By "tedious", I was referring to doing more analysis. You asked if I
: happened to do that analysis, and my answer was: "No, because that would
: require a lot more than a single simple observation."
:
: I don't really see what your beef is.

I'm trying to draw knowledge from the well and you're telling me it's too
hard to bring the bucket to the top. (O:=

: >>> ...How can I take adavantage of getRows with iteration where I want
: >>> cosmetic differences in the results...
: >
: > ...If is use getrows and want every other background a different color,
: > I have use a MOD or something to determine which will have a negative
: > impact on the advantage of using getrows.
:
: It seems you already know the answer to your question.

It shouldn't because I don't. I'm posing these questions to gain knowledge
because I may not have considered some variables and there are people here a
lot better at this than I am.

: > ...I'm still using For...Next loops, which will require a decision to
: > determine which row is which...
:
: Does it really? Here's an alternative with no "decision":
:
: <style>
: tr.row0 { background-color:#fff }
: tr.row1 { background-color:#eee }
: </style>
: <% for (i=0; i<ary.length; i++) { %>
: <tr class="row<%=i% 2%>"> ...
:
: Here's another:
:
: <% var colors=["#fff","#ee e"]
: for (i=0; i<ary.length; i++) { %>
: <tr stlye="backgrou nd-color:<%=colors[i%2]%>"> ...

Ok, that's helpful. Thank you.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #27
Roland Hall wrote:
"Bob Barrows [MVP]" wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Roland Hall wrote:

If is use getrows and want every other background a different color,
I have use a MOD or something to determine which will have a
negative impact on the advantage of using getrows.
But it still beats the alternative of looping through your recordset.


Yes, I would agree. I read a document that says getrows sometimes,
getstring sometimes AND recordset loops sometimes but not sure where
I read it. It was either aspfaqs.com or 4guysfromrolla. com, which I
think is run by the same people.


It was this article on aspfaq:
http://www.aspfaq.com/show.asp?id=2467

Would you agree that recordset loops can be used sometimes?


Yes, for things like subtotals, grouping, etc. But always disconnect them
first.
At this point getstring
seems to have a disadvantage since it uses markup as parameters.
There is nothing that says, use all even or all odd rows with
different markup.
Right

If the comparison is only for a drab layout, then it's not that
realistic except perhaps to an accountant. I'm still using
For...Next loops, which will require a decision to determine which
row is which unless you use alternating loops separating odd and
even and that seems to be bad alternative

Or you could incorporate some of that logic into the query that
produces the resultset.
Perhaps a computed column that indicates the color to be used for a
row ...


A computer column that returns a hex value?


Sure, why not? or a color in plain English. Or a flag to be read by your
loop. Of course, your data source has to be set up so that this logic can be
applied by the sql statement.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #28
Yes! A SELECT...CASE will perform far better than IF...THEN
Constant! I use GetRows() exclusively when looping through data.

'dlbjr
'Pleading sagacious indoctrination!
Jul 22 '05 #29
"Bob Barrows [MVP]" wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
: Roland Hall wrote:
: > "Bob Barrows [MVP]" wrote in message
: > news:%2******** ********@tk2msf tngp13.phx.gbl. ..
: >> Roland Hall wrote:
: >>>
: >>> If is use getrows and want every other background a different color,
: >>> I have use a MOD or something to determine which will have a
: >>> negative impact on the advantage of using getrows.
: >>
: >> But it still beats the alternative of looping through your recordset.
: >
: > Yes, I would agree. I read a document that says getrows sometimes,
: > getstring sometimes AND recordset loops sometimes but not sure where
: > I read it. It was either aspfaqs.com or 4guysfromrolla. com, which I
: > think is run by the same people.
:
: It was this article on aspfaq:
: http://www.aspfaq.com/show.asp?id=2467

That may be the one.

: > A computer column that returns a hex value?
:
: Sure, why not? or a color in plain English. Or a flag to be read by your
: loop. Of course, your data source has to be set up so that this logic can
be
: applied by the sql statement.

I was only verifying. A different approach than I have used. I'm sure I'll
find all kinds of performance gains if I spend more time on SPs and looking
at SQL alternatives.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
3497
by: Brian Patterson | last post by:
I have noticed in the book of words that hasattr works by calling getattr and raising an exception if no such attribute exists. If I need the value in any case, am I better off using getattr within a try statement myself, or is there some clever implementation enhancement which makes this a bad idea? i.e. should I prefer: if hasattr(self,"datum"): datum=getattr("datum") else: datum=None
12
17311
by: Fred | last post by:
Has anyone a link or any information comparing c and c++ as far as execution speed is concerned? Signal Processing algorithms would be welcome... Thanks Fred
12
8354
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I will work on preparing SQL statements that will create the tables, insert sample record and run the SP. I would hope people will look at my SP and give me any hints on how I can better write the SP.
6
2324
by: teedilo | last post by:
We have an application with a SQL Server 2000 back end that is fairly database intensive -- lots of fairly frequent queries, inserts, updates -- the gamut. The application does not make use of performance hogs like cursors, but I know there are lots of ways the application could be made more efficient database-wise. The server code is running VB6 of all things, using COM+ database interfaces. There are some clustered and non-clustered...
5
4009
by: Scott | last post by:
I have a customer that had developed an Access97 application to track their business information. The application grew significantly and they used the Upsizing Wizard to move the tables to SQL 2000. Of course there were no modifications made to the queries and they noticed significant performance issues. They recently upgraded the application to Access XP expecting the newer version to provide performance benefits and now queries take...
115
7661
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical transform function. When compiling under gcc on my big-endian PowerPC (Mac OS X), declaring this array as "static" DECREASES the transform throughput by around 5%. However, declaring it as "static" on gcc/Linux/Intel INCREASES the throughput by...
13
2770
by: bjarne | last post by:
Willy Denoyette wrote; > ... it > was not the intention of StrousTrup to the achieve the level of efficiency > of C when he invented C++, ... Ahmmm. It was my aim to match the performance of C and I achieved that aim very early on. See, for example "The Design and Evolution of C++". -- Bjarne Stroustrup; http://www.research.att.com/~bs
13
4152
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make sense to punch out from managed code to native code (I was using IJW) in order to do some amount of floating point work and, if so, what that certain amount of floating point work was approximately. To attempt to do this I made a program that...
7
2581
by: Michael D. Ober | last post by:
When calling Enqueue, the internal array may need to be reallocated. My question is by how much? In the old MFC array classes, you could tell MFC how many additional elements to add to the array when it needed to reallocate, which greatly boosted performance relative to adding 1 element at a time. Thanks, Mike Ober.
1
2459
by: jvn | last post by:
I am experiencing a particular problem with performance counters. I have created a set of classes, that uses System.Diagnostics.PerformanceCounter to increment custom performance counters (using .Net 2.0) The performance counter categories have been successfully created. When the set of classes are used by a WinForm test harness application, they function as expected, and the performance counters can be seen to be updated by using the...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.