I would just like to find out which way is the fastest or the best for putting quite some amount of variables in properties, I had ± 10 properties which I used to store data that gets updated about every second, is it better to store the values in one property set as an array that stores the data or to have more properties and let each one store a specific value?
Thanks in advance,
I normally roll with a dictionary rather than an array, depending on what I’m doing with the values. If it’s simple values I’ll go array. If it’s something I need to be more like a pair (Key:Value) dictionary is the way to go. Arrays in Xojo are usually quite fast, so you can’t really go wrong there.
Oh oky thanks so much, I’ll give it a try!
Dictionaries are fast, but I thought Arrays were slow? Maybe only when you need to iterate over them, but it would certainly depend on how you use them.
Iterating arrays can be slow, but the degree to how slow is really dependent upon implementation. Dim nothing inside the loop. Cache your max value. Disable StackOverflowChecking when you can.
Doing these things can make array iteration really quick. I ran the numbers a few years back when I needed to build 2d or 3D data matrices for a project. Ill see if I can find my test harness at some point and send you the numbers.
You can even have different types of properties in 1 array by using an auto array;
Dim myArray() As Auto