I see that there are a few options for creating arrays in Servoy developer, such as
new Array()
new Array(number)
It seems you don’t need to specify the size of an array when you create it, but is it better to if you can? The method would need to look at the database to find out the size the array should be.
I’m creating a method to manipulate some arrays. I could eliminate some lines of code if I don’t specify the size of the array, but would that be wasting memory or cpu cycles?
In other words, is it more efficient to do
numberOfItems = databaseManager.getFoundSetCount(foundset);
new myArray(numberOfItems);
myArray = databaseManager.getFoundSetDataProviderAsArray(foundset,'item1');
or just
new myArray()
myArray = databaseManager.getFoundSetDataProviderAsArray(foundset,'item1');
?
Users may run this method many times and, obviously, I want the users to see as little delay as possible.