Excellent stuff Bob (and Jim thanks for your input as well!)!

Thank you very much for performing such a study into the behaviour,
unfortunately I am not able to do this myself, as I have quite a lot of
work to do.

I will definately have a look at the main procedure and look if I can
change the BASE to 0 for the arrays that use the split function as
output.

Again, many thanks for your help!

Regards,
CoRrRan


"Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in
news:uGljEcNFFHA.624@TK2MSFTNGP15.phx.gbl:

> Jim,
>
> My instinct tells me that you are correct, but I doubted it woiuld be
> significant. So I did some tests.
>
> I ran 4 tests,
> - a standard Spli
> - the pSplit routine
> - pSplit as an addin
> - a standard split with a re-basing of the array (0 to 1)
>
> The results were interesting.
>
> As expected, pSplit was substantially slower than Split, but even I
> wasmazed at how much slower, a factor of 8-9 times as long.
>
> The addin split, rather surprisingly, was slower that pSplit.
> Presumably, the advantage of the pre-compiled code was lost in the
> time taken to invoke the addin (I set a reference to the addin).
>
> The standard Split, with rebasing was the second fastset, but again
> was 2.5 times as slow as a standard split.
>
> If I were the OP and speed is that importnat, I would bite the bullet
> and recut the code to be 0 based.
>
> Here are the results.
>
> Split - 8.683594
> pSplit - 69.22656
> Addin Split - 69.37109
> Split & re-base - 19.82813
>
> And here is the code I used to test it.
>
> Sub test()
> Dim str As String
> Dim ary, ary2
> Dim i As Long
> Dim j As Long
> Dim t
>
> str = "1,2,3,4,5,6,7,8,9,10"
>
> t = timer
> For i = 1 To 1000000
> ary = Split(str, ",")
> Next i
> Debug.Print "Split - " & timer - t
>
> t = timer
> For i = 1 To 1000000
> ary = pSplit(str, ",")
> Next i
> Debug.Print "pSplit - " & timer - t
>
> t = timer
> For i = 1 To 1000000
> ary = addinSplit(str, ",")
> Next i
> Debug.Print "Addin Split - " & timer - t
>
> t = timer
> For i = 1 To 1000000
> ary = Split(str, ",")
> ReDim ary2(1 To UBound(ary) + 1)
> For j = 0 To UBound(ary)
> ary2(j + 1) = ary(j)
> Next j
> Next i
> Debug.Print "Split & re-base - " & timer - t
>
> End Sub
>