Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Speed Issue

Status
Not open for further replies.

boflexson

Programmer
Oct 16, 2001
74
US
I found a speed issue in my app,
Here is the form:

Option Explicit

Private mCol As Collection


Private Sub Command1_Click()
Dim lngIndex As Long
Dim objTest As clsTest

Set mCol = New Collection
For lngIndex = 1 To 20000
Set objTest = New clsTest
mCol.Add objTest, CStr(lngIndex)
Set objTest = Nothing
Next

MsgBox "done"


End Sub

Private Sub Command2_Click()
Set mCol = Nothing
MsgBox "Done"
End Sub


''''''''''''''''''''''
Put this in a module:
Public Type Test_Buffer
strBuffer As String * 8000 'SLOW 'Item 1
'strBuffer As String 'Fast 'Item 2
End Type
'''''''''''''''''''''''
This is clsTest:
Option Explicit

Private mudtEditProperties As Test_Buffer 'Slow/Fast Item 3
'Private strBuffer As String * 8000 'Fast 'Item 4

Private Sub Class_Initialize()

strBuffer = String$(8000, "L")
End Sub
'''''''''''''''''

Ok The way it is now it is super slow to set the collection to nothing
If you comment item 1 and uncomment item 2 it's fast
If you comment item 3 and uncomment item 4 it's fast

So, using a large (or a lot of small) string * ####
inside a udt it's slow, if you do it without the udt or just as string inside the udt it's fast.

Any Ideas.
I might have ways to change the code to not use the udt, but this format is used on 300 objects, 1 for each table. And functionality of clsTest is exploiting some functionality of the udt (in particular, LSET)

So, If there is a way to speed up the clearing of this from ram it would save me hours of recoding...

-Bo









-Adam T. Courtney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top