The previous performance article was about how to get recordset from database with minimum of consumed processor time. This article tels about how to get a HTML page from the recordset with the same limitations - minimum of consumed time.
Performance test configuration- P200, 128MB RAM
- Win NT 4.0 SP5
- SQL 6.5 SP5
- IIS 4
- MDAC 2.1 SP2
- SQL server on the same machine as IIS
ProcedureFirst of all we have to create test data. The test data was created in SQL 6.5 as a single table with mixed char/int/money columns and 50 rows :
The second, we have to open recordset from database :CREATE TABLE RSTest ( IntCol int, CharCol char(32), VarCharCol varchar(200), MoneyCol money ) go DECLARE @Row int SELECT @Row = 0 WHILE @Row<50 BEGIN INSERT INTO RSTest VALUES( RAND()*5000, REPLICATE(char(RAND()*25+65), RAND()*32), REPLICATE(char(RAND()*25+65), RAND()*200), RAND()*50000000 ) SELECT @Row = @Row + 1 END
Create HTML page from Recordset
Script time and consumed times
ResultsSix codes, six different times. There are some tips based on the time tests :
1. Use buffering. All the codes have better time results with buffering.
2. Use temporary variables to store small parts of string HTML, and then paste the small parts to the whole (4 versus 3, 3 times faster).
3. Use temporary variables to resolve interface only one, not in each row loop (Set IntCol = RS("IntCol"), 5 versus 4, up to 50% faster)
4. Use GetString method of recordset object if you convert recordset data by only default way (6 versus 5, 2 times faster than best VBS code). GetString method is only 15% slower than plain recordset move to the last row (17.82 ms GetString, 15ms move).
4) Script time - TickCount [ms] of the operation. The time has two parts - Kernel+User time of calling thread and execution time of all other processes.
Script Time contains also Kernel+User time of SQL server and Kernel+User time of IIS.
5) Kernel+User time - times of calling thread in [ms]
The time has only relative meaning - because the time was on the pure configuration (P200/128M), the real times will be better.
for 'Best way to get HTML page from a recordset' articleRecordset convertor performance testRecordset convertor is great object which enables direct output of binary database data from ASP page as DBF/MDB.
ASP/VBS database performance test and comparison.ADO, DAO, RDO, MDB, SQL, OLEDB and ODBC comparison, performance test of objects that can be used for database access on server-side in ASP.
Copyright and use this code
The source code on this page and other samples at http://www.motobit.com/tips/ are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
2. Link this sample from you page.
<A Href="http://www.motobit.com/tips/detpg_rshtml/" Title="Performance tests of six different VBS codes, each of them generates the same HTML table." >Best way to get HTML page from a recordset</A>
© 1996 - 2013 Antonin Foller (Google Plus), Motobit Software | About, Contacts | (Find us on Google+)
Partner sites: Search Czech Last minute Zajezdy Obsah na mobil Hry na mobil Java Hry Print-shop Affiliate programy
|IISTracer - IIS ISAPI real-time monitor IISTracer is a real-time monitoring tool for Microsoft IIS, which will show/log you what is happenning on IIS server right now. It let's you reveal problems with long-running scripts (.asp, .cgi, cfm...), hang-up states and low resource situations and lets you stop long-running requests (uploads/downloads).||ActiveX User account Manager - Set of simple objects for creating, deleting, and managing user accounts, groups, servers and domains in the Windows NT environment.|
|Active log file - Hi-performance text file logging for ASP/VBS/VBA applications. Lets you create daily/weekly/monthly log files with variable number of logged values and extra timing and performance info.||ActiveX windows registry editor - Intuitive, easy to use COM interface to windows registry. Set of classes to read/enumerate/modify windows registry keys and values from ASP, VBS and T-SQL.|
|ActiveX/ASP Multi Dictionary object - Free-threaded hi-speed dictionary algorithm with unique/nonunique keys (map/multimap). Connect to another dictionary object in the same process. Lock and Unlock methods to synchronize tasks (application scope). Share ASP Application/Session objects.||Export DBF/MDB from ASP - Conversion from recordset to MDB/DBF. Direct binary output of MDB or DBF files from ASP pages with one row of code.|
|Pure-ASP upload - lets you upload files using Pure ASP VBS code (using multipart/form-data and input type=file).||ByteArray - Works with safearray binary data (VT_UI1 | VT_ARRAY) - save/restore binary data from disk, find, work with code pages, convert to string/hexstring(SQL).|
|WebChecker - Checks http, https, ftp and gopher internet connections in regular intervals. Lets you monitor web site functionality (uptime). Enables restart or notification on problems.||HTTPLog ISAPI filter - Lets you log incomming/outgoing http header and document data to separate files. Monitor of IIS service input/output.|