In response to: Using Lotusscript lists to increase performance
I now modified the code to use NotesViewEntry.ColumnValues() to get the value I am looking for. I also had to add a column displaying that field in my view.
The code actually took longer, 370 seconds, but all that was in the calls to doc.Save(). The actual lookup went from a total of 15 seconds down to just below 5 seconds.
So let’s remove the time-consuming doc.Save() command, just to see what the actual execution time is. Here is the result for my four versions of the same import agent:
|Individual lookups for each entry imported
|Building list of documents using view lookup/doc.GetItemValue() before importing
|Building list of documents at first use, using view lookup/doc.GetItemValue()
|Building list of documents at first use, using viewentry lookup/entry.ColumnValues()
By removing the print statement that give feedback about the progress (printing every 100 entries), additional 3 seconds would be saved.
So there is a substantial performance benefit when you don’t have to open the actual document and read a value, but can use a view column value instead. If you need multiple values from one document, one easy way is to combine all values into one column, separated with a character that you will never enjounter in the data (I am partial to the ~ character, it also makes it easy to read) and then use Split() to get the individual values.