3 hours ago
(This post was last modified: 2 hours ago by Steven Pringels.)
Phenomenal speed Stanley.
On my overclocked AMD Ryzen 9 3900X (4.25Ghz) which is quite old I get:
add 100,000 random key/value items
Time = 000.078
Count = 100,000 duplicate keys not allowed
find 100,000 random keys
Time = 000.010
Hi Stanley,
The reason why you have the crash is because of the ObjFromLong should not use ObjPtr because the object doesn't exist and therefore the pointer isn't allocated (null pointer).
This works
1 million items gives me:
add 1,000,000 random key/value items
Time = 000.853
Count = 999,909 duplicate keys not allowed
find 1,000,000 random keys
Time = 000.172
On my overclocked AMD Ryzen 9 3900X (4.25Ghz) which is quite old I get:
add 100,000 random key/value items
Time = 000.078
Count = 100,000 duplicate keys not allowed
find 100,000 random keys
Time = 000.010
Hi Stanley,
The reason why you have the crash is because of the ObjFromLong should not use ObjPtr because the object doesn't exist and therefore the pointer isn't allocated (null pointer).
This works
Code:
Class Method LongFromObj(o As IUnknown) As dword
If IsObject(o) Then
o.AddRef()
Method = ObjPtr(o)
'Method = Peek(Dword, VarPtr(o))
End If
End Method
Class Method ObjFromLong(ByVal h As dword) As IUnknown
Local o As IUnknown
If h Then
Poke Dword, VarPtr(o), h
o.AddRef()
Method = o
End If
End Method
1 million items gives me:
add 1,000,000 random key/value items
Time = 000.853
Count = 999,909 duplicate keys not allowed
find 1,000,000 random keys
Time = 000.172