ASP Performance

D

dlbjr

Why not use something like the code below to set row style:
No Mod Check or any heavy processing code needed.

Function GetRowStyle(str1)

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!
 
D

dlbjr

It is best to use tags as such in asp:

<script language="VBScript" runat="Server">

</script>

<script language="javascript" 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!
 
R

Roland Hall

in message
: 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
 
R

Roland Hall

in message : 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(str1)
:
: 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
 
R

Roland Hall

in message : "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","#eee"]
: for (i=0; i<ary.length; i++) { %>
: <tr stlye="background-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
 
B

Bob Barrows [MVP]

Roland said:
in message


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.
Right


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
 
D

dlbjr

Yes! A SELECT...CASE will perform far better than IF...THEN
Constant! I use GetRows() exclusively when looping through data.

'dlbjr
'Pleading sagacious indoctrination!
 
R

Roland Hall

in message
: Roland Hall wrote:
: > "Bob Barrows [MVP]" wrote in message
: > : >> 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
 
D

Dave Anderson

Roland said:
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.

Your question: "How can I take adavantage of getRows with iteration
where I want cosmetic differences in the results?"

Your answer: "If is use getrows and want every other background a
different color, I have use a MOD or something..."

As I said, you already know the answer to your question. If you are
iterating through the array produced by GetRows(), you can use (rownum Mod
2). What more were you expecting?



--
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.
 
R

Roland Hall

in message
: Roland Hall wrote:
: >> 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.
:
: Your question: "How can I take adavantage of getRows with iteration
: where I want cosmetic differences in the results?"
:
: Your answer: "If is use getrows and want every other background a
: different color, I have use a MOD or something..."
:
: As I said, you already know the answer to your question. If you are
: iterating through the array produced by GetRows(), you can use (rownum Mod
: 2). What more were you expecting?

I wasn't doing it as you were with a dynamic class name. I had a
conditional in the middle of it. Your method eliminates the conditional and
removes the performance hit I was referring to.

--
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
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top