Help debugging code

R

RB Smissaert

An array element that has no value assigned to it is Empty.
Don't think there is a problem with that, but if you think Len is faster I
change it to that.
I think somebody told me testing with Empty was faster, but I will run a
test on this.

RBS
 
R

RB Smissaert

Word Heretic,


Have run a few tests on this and my findings are:

If the array has all empty elements or all elements have a numeric value the
testing with = Empty is about 3 times faster. The higher the number the
slower the Len comparison.
If the array has all elements with a string value testing with = Empty is
about 25% faster.

So I don't think testing with Len is faster.

Below the code for testing this.

Option Explicit
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private lStartTime As Long
Private lEndTime As Long

Sub IsEmptySpeedTester()

Dim arr(1000000)
Dim i As Long

For i = 0 To 1000000
arr(i) = 100.1
Next

lStartTime = timeGetTime()

For i = 0 To 1000000
'If arr(i) = Empty Then
If Len(arr(i)) = 0 Then
End If
Next

lEndTime = timeGetTime()

MsgBox "Done in " & lEndTime - lStartTime & " msecs", , ""

End Sub



RBS
 
W

Word Heretic

G'day "RB Smissaert" <[email protected]>,

Ahhhh! OK, I think I have it now.

I dont use your method for building tables!

I would do this:

Output rows as paras, with tab separated cells (or if your cutten
pastes hold tabs, pick another unique character).

Once you have finished, select everything you inserted and
..converttotable

This is also the fastest way.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


RB Smissaert reckoned:
 

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

Top