-
WebClasses and Performance
I'm pretty new to WebClasses. I'm writing a VB WebClass app that takes data
from an Access97
database and presents it in table format. Pretty simple stuff.
However, sometimes I'm building a table of 200-300 rows. My WebClass code
simply takes the data on
each row of the table, slaps a <TD> before it and a </TD> behind it, and
concatenates the whole
table together in a string variable.
At the end of the routine, I set my TagContents to equal the string variable
holding the table.
When my recordset is small, the WebClass runs fine. However, when the recordset
is large (200-300
records), it takes forever to build the table string. I've done some quick
timings and, due to the
number of fields in my table, I'm only able to build 6-10 table rows a second.
For a 300 row table,
that's quite a wait!
Any suggestions on how to speed things up? I'm using constants wherever
I can. Also, when I test
the code (not in a WebClass) to output to a file or the intermediate window,
it runs much more quickly.
Has anyone else run into WebClass performance issues? How did you get around
them?
Thanks!
David.
-
Re: WebClasses and Performance
I don't have a solution for you using webclasses, I just thought I would my
2 cents on WebClasses....WebClasses are EVIL. They're an incredible
technology that simply doesn't work well yet. For your speed problem, have
you thought about using ASP and COM. Have a COM object create the string
for you in a nice tight loop and then simply instanciate that object from
ASP and do a Response.write objCom.CreatedString .
Remember WebClasses are EVIL....and it's too bad cause it sure is a kick ***
technology...Maybe they'll fix there bugs in VB7. They tend to also skip
tags when you have a lot of concurrent users.
"David" <hoerster@netscape.net> wrote in message
news:3950b640$1@news.devx.com...
>
> I'm pretty new to WebClasses. I'm writing a VB WebClass app that takes
data
> from an Access97
> database and presents it in table format. Pretty simple stuff.
>
> However, sometimes I'm building a table of 200-300 rows. My WebClass code
> simply takes the data on
> each row of the table, slaps a <TD> before it and a </TD> behind it, and
> concatenates the whole
> table together in a string variable.
>
> At the end of the routine, I set my TagContents to equal the string
variable
> holding the table.
>
> When my recordset is small, the WebClass runs fine. However, when the
recordset
> is large (200-300
> records), it takes forever to build the table string. I've done some
quick
> timings and, due to the
> number of fields in my table, I'm only able to build 6-10 table rows a
second.
> For a 300 row table,
> that's quite a wait!
>
> Any suggestions on how to speed things up? I'm using constants wherever
> I can. Also, when I test
> the code (not in a WebClass) to output to a file or the intermediate
window,
> it runs much more quickly.
>
> Has anyone else run into WebClass performance issues? How did you get
around
> them?
>
> Thanks!
> David.
-
Re: WebClasses and Performance
"Lior Amar" <lior_amar@hotmail.com> wrote:
>Remember WebClasses are EVIL....and it's too bad cause it sure is a kick
***
>technology...Maybe they'll fix there bugs in VB7.
Based on what Microsoft's said so far about VB7, WebClasses appear to be
a 'dead' technology. WebClasses will probably be retained for backwards
compatibility but not much else.
- Jim
-
Re: WebClasses and Performance
David,
Concatenating a lot of strings in VB is a ver slow process (WebClass or
not).
I use two methods to speed them up.
1) create a large string and place the variables where they belong using
MID$
2) open a file for output, print the variables to the file, close the file,
reopen it as binary, define a string as the same length as the file and get
the variable from the file.
Using MID$ is about 1000 times faster than concatenating, and I use it when
I really need the speed.
Using a file is about 100 times faster than concatenating in memory. Since
itīs easier to do than MID$ I use it when speed is not as important.
(By the way I haven't done actual timing on this since I first ran across
the problem when VB4 came out)
Gary
-
Re: WebClasses and Performance
David,
Just out of curiosity I tested the speed for each method. It took 300 times
as long to concatenate in memory as it did to write to a file on the hard
drive, and mid$ was so fast I coundīt even get a reading on it without
increasing the iterations.
Gary
Dim x As Integer
a$ = String$(100, 65)
' test 1 concatenate in memory
tt! = Timer
For x% = 1 To 1000
b$ = b$ & a$
Next
Debug.Print Format$(Timer - tt!, "0.00000")
' test 2 concatenate using mid$
tt! = Timer
b$ = Space$(1000 * Len(a$))
For x = 1 To 1000
Mid$(b$, ((x - 1) * Len(a$)) + 1, Len(a$)) = a$
Next
Debug.Print Format$(Timer - tt!, "0.00000")
' test 3 concatenate using hard drive
tt! = Timer
fff = FreeFile
Open "temp" For Binary As fff
For x = 1 To 1000
Put fff, , a$
Next
b$ = Space$(LOF(fff))
Get fff, 1, b$
Close fff
Kill "temp"
Debug.Print Format$(Timer - tt!, "0.00000")
'results:
3.19141
0,00000
0,10938
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks