First off, let me say that I am still very fond of Classic ASP. Most projects I work on are entirely .NET at this point, however, there is a tremendous sense of pride over my mastery of classic ASP. When I need a very quick solution I am all too happy to load up notepad and just write it out without hunting down strange errors or methods that are not yet "old hat."
For the sake of passing on knowledge, and getting it out of the way, I must say, embrace .NET
With that in mind I am going to skip all the time proven testing data and get right to it. If you are using Classic ASP here is how to optimize for speed.
Use it.
If that was not clear enough...Use it.
Don't do it.
If that was not clear enough...Don't do it.
Let's move on
Some prefer getString, however I am an avid fan of GetRows
set recs = conn.execute("select fields from table")
if not recs.eof
recsArray = recs.getrows()
has recs = true
end if
recs.close
set recs = nothing
with response
if hasrecs then
.write "<table>"
for rows = 0 to ubound(recsArray,2) 'for each row
.write "<tr>"
for cols = 0 to ubound(recsArray,1)
.write "<td>"
.write recsArray(cols,rows)
.write "</td>"
next
.write "</tr>"
next
.write "</table>"
else
.write "No records"
end if
end with
I gurantee you will see a significant performance boost.
Fixed tables render faster than either those set at a percentage of it's parent or those, god forbid, not set at all
<table style="table-layout: fixed;"> <colgroup> <col width="50" /><col width="50" /><col width="50" /><col width="50" /> </colgroup> <tr> <td>.... data... </td> <td>.... data... </td> <td>.... data... </td> <td>.... data... </td> </tr> </table>
Trim back on the amount of HTML you need to output. It's 2008, for Pete's sake, get rid of all that inline styling.
Call from your datasouce what it is that you need. No more "SELECT * FROM Table" when you only need two columns
Also, no more mid-loop secondary recordsets, get it the first time around, stick it in the array and call it a day.
They do
If you are working in Classic ASP or VBS and you are suffering from poor application speed, you now have the knowledge to fix it.