In a listbox I show the main data on-demand when the listbox rows show. But for house-keeping I need some keys in a dictionary. Why does this take 5 seconds for 10.000 rows?
dim HasNextRecord as Boolean = DataCursor.FirstRecord
dim currentPosition as Integer = 1
dim ValDataField as VField = DataCursor.Field(DataField)
dim ValDataProviderField as VField = DataCursor.Field(DataProviderField)
dim DataValue, DataProviderValue as String
while HasNextRecord and currentPosition <= myRowCount
DataValue = ValDataField.GetString
DataProviderValue = ValDataProviderField.GetString
RowIDInformation(currentPosition) = new Dictionary
RowIDInformation(currentPosition).Value(DataField) = DataValue
RowIDInformation(currentPosition).Value(DataProviderField) = DataProviderValue
if currentDataFieldValue = 0 then
currentDataFieldValue = val(DataValue)
elseif currentDataFieldValue <> val(DataValue) then
currentDataFieldValue = -1
end if
currentPosition = currentPosition + 1
HasNextRecord = DataCursor.NextRecord
wend
I've had a look with Instruments at what happens here. It told me that 76% of all time is spent in
HasNextRecord = DataCursor.NextRecord
Of course, I could load the necessary data on-demand. But when a user does a Cmd-A then I need the information.
Any ideas?
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals