Skip to content

Conversation

@pqrobson
Copy link

Hey, I was looking for some array.bas to improve my projects and this is awesome! But I use a function to sort array that I came up with a long time ago that is way faster than the one here. As a thank you for this project, I'd like to contribute with the arraySorterSDim (for single dim arrays) and the ArraySorter (for two dim arrays)

You can compare the performance with a simple test:
Function getFaster()
Dim myArr(5000) As Variant
Dim m1Arr() As Variant
Dim m2Arr() As Variant
Dim t1 As Double
Dim i As Double
For i = 0 To 5000
myArr(i) = Rnd
Next i

t1 = Time
m1Arr = ArraySort(myArr)
Debug.Print "time for m1:", Time - t1

t1 = Time
m2Arr = arraySorterSDim(myArr)
Debug.Print "time for m2:", Time - t1

End Function

Wich gave me:
time for m1: 00:00:21
time for m2: 00:00:09

Hey, I was looking for some array.bas to improve my projects and this is awesome! But I use a function to sort array that I came up with a long time ago that is way faster than the one here. As a thank you for this project, I'd like to contribute with the arraySorterSDim (for single dim arrays) and the ArraySorter (for two dim arrays)

You can compare the performance with a simple test:
Function getFaster()
Dim myArr(5000) As Variant
Dim m1Arr() As Variant
Dim m2Arr() As Variant
Dim t1 As Double
Dim i As Double
For i = 0 To 5000
    myArr(i) = Rnd
Next i

t1 = Time
m1Arr = ArraySort(myArr)
Debug.Print "time for m1:", Time - t1

t1 = Time
m2Arr = arraySorterSDim(myArr)
Debug.Print "time for m2:", Time - t1

End Function

Wich gave me: 
time for m1:  00:00:21 
time for m2:  00:00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant