Here is my implementatio of collectio. It is faster and uses less memory. Every operation can be completed in log time in the worst case scenario. I'v been using it for the last 20 years and maybe now is time to share it with the world.
Private Sub Command1_Click()
Dim c As New VMMC, i As Long
c.Cols = 2
c.ColType(0) = vmeInteger
c.ColType(1) = vmeString
' add million items at the end
For i = 0 To 1000000
c.Add , i
c(i, , 0) = i
c(i, , 1) = Str(i)
Next
' delete 500000 items from the middle
For i = 0 To 500000
c.Remove Int(c.Count / 2)
Next
' update values
For i = 0 To c.Count - 1
c.Cell(i, , 0) = 1000000 - i
Next
MsgBox c.Count
End Sub
Nice project works very well.
I haven't had time to investigate the dll.
is it possible to use it without registering it like other dlls are used.
example.
Code:
Private Declare Function getNumPages Lib "pdftotext.dll" (ByVal lpFileName As String, Optional ByVal lpLogCallbackFunc As Long, Optional ByVal lpOwnerPassword As String, Optional ByVal lpUserPassword As String) As Integer
Nice project works very well.
I haven't had time to investigate the dll.
is it possible to use it without registering it like other dlls are used.
example.
Code:
Private Declare Function getNumPages Lib "pdftotext.dll" (ByVal lpFileName As String, Optional ByVal lpLogCallbackFunc As Long, Optional ByVal lpOwnerPassword As String, Optional ByVal lpUserPassword As String) As Integer
Regards thanks
This is COM dll and it should be used as such. I don't remember that there are any other exported functions except those required by COM specifications.
These are high-level abstractions but the source code is readily available in the SDK and if you dig deep enough you can find the underlying hash_bytes function.
An open source collection class that is better than VB6.Collection will be very popular with VB6ers.
I'll take the time to compare your VMMC with RC6.MemDB/RC6.Recordset to see which one performs better. Thank you for sharing.
I would describe performance of VMMC as "jack of all trades, master of none". This means that if you have a problem you can solve with a map, if you use some implementation of hash map, it will probably perform better. If you have a problem you can solve with a simple array, it will perform better if you just use VB's Array. But if you need something that acts as an array, map and both, you probably won't find anything better than VMMC because VMMC can perform ANY operation in O(n)=log (n) (or O(n)=c) and still use memory gently.
These are high-level abstractions but the source code is readily available in the SDK and if you dig deep enough you can find the underlying hash_bytes function.
I would describe performance of VMMC as "jack of all trades, master of none". This means that if you have a problem you can solve with a map, if you use some implementation of hash map, it will probably perform better. If you have a problem you can solve with a simple array, it will perform better if you just use VB's Array. But if you need something that acts as an array, map and both, you probably won't find anything better than VMMC because VMMC can perform ANY operation in O(n)=log (n) (or O(n)=c) and still use memory gently.
I tested your VMMC and it has excellent performance. I've always wanted to have a VMMC-like high-performance multi-column collection. It would be nice to be able to change VMMC's C++ code to VB6 code.
I tested your VMMC and it has excellent performance. I've always wanted to have a VMMC-like high-performance multi-column collection. It would be nice to be able to change VMMC's C++ code to VB6 code.
And how would you implement columns in VB6? It is not fun if all the columns are just variants.
And how would you implement columns in VB6? It is not fun if all the columns are just variants.
Yes, that's probably the crux of the matter. From this point of view, it is almost impossible to use VB6 to achieve high performance and use less memory like VMMC. Thank you, vamvam.
Multi-Column collection are one of the key classes that RC6 lacks the most.
Last edited by SearchingDataOnly; Jan 22nd, 2025 at 09:58 PM.
I wrote a simple MuliColumnList with RC6.ArrayList. I tested VMMC against MyMuliColumnList and the results are as follows:
In VB6-IDE Mode
Code:
====================================
Test VMMC
Add million items at the end: 3,911.42msec
Delete 500000 items from the middle: 1,279.59msec
Update values: 1,248.95msec
Item count: 500000
====================================
Test MyMultiColumnList
Add million items at the end: 6,605.85msec
Delete 500000 items from the middle: the operation was canceled because it took too long.
Update values: 1,781.10msec
Item count: 1000001
In Exe Mode
Code:
====================================
Test VMMC
Add million items at the end: 3,014.03msec
Delete 500000 items from the middle: 333.41msec
Update values: 808.62msec
Item count: 500000
====================================
Test MyMultiColumnList
Add million items at the end: 3,677.15msec
Delete 500000 items from the middle: the operation was canceled because it took too long.
Update values: 1,163.66msec
Item count: 1000001
Delete 500000 items from the middle: 1,055,231.86msec
Last edited by SearchingDataOnly; Jan 22nd, 2025 at 10:03 PM.
I wrote a simple MuliColumnList with RC6.ArrayList. I tested VMMC against MyMuliColumnList and the results are as follows:
In VB6-IDE Mode
Code:
====================================
Test VMMC
Add million items at the end: 3,911.42msec
Delete 500000 items from the middle: 1,279.59msec
Update values: 1,248.95msec
Item count: 500000
====================================
Test MyMultiColumnList
Add million items at the end: 6,605.85msec
Delete 500000 items from the middle: the operation was canceled because it took too long.
Update values: 1,781.10msec
Item count: 1000001
In Exe Mode
Code:
====================================
Test VMMC
Add million items at the end: 3,014.03msec
Delete 500000 items from the middle: 333.41msec
Update values: 808.62msec
Item count: 500000
====================================
Test MyMultiColumnList
Add million items at the end: 3,677.15msec
Delete 500000 items from the middle: the operation was canceled because it took too long.
Update values: 1,163.66msec
Item count: 1000001
Delete 500000 items from the middle: 1,055,231.86msec
As I see it, they both have similar performance and if ArrayList would have a cursor that moves forward and backward it would slightly outperform VMMC.