If you have to access documents through viewentries, you may improve the performance by 10% to 30% using db.GetDocumentByUNID instead of entry.Document.
Some code snippets:
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim entry As NotesViewEntry
Dim nav As NotesViewNavigator
Set view = db.GetView("myView")
Set nav = view.CreateViewNav()
Set entry = nav.GetFirstDocument
While Not (entry Is Nothing)
If myCondition Then
' Normal performance with
' Set doc = entry.document
' Better performance with
' Set doc = db.GetDocumentByUNID( entry.UniversalID )
' or if db object isn't directly available
Set doc = entry.Parent.Parent.GetDocumentByUNID( entry.UniversalID )
End If
Set entry = nav.GetNextDocument(entry)
Wend
The performance improvement depends on the Notes and Domino versions. Of course there are many different ways to get documents. The script above only shows up the preformance difference between the two mentioned methods entry.Document and db.GetDocumentByUNID. Both methods are absolutly replacable whtin the scope of this sample. Other methods may need more preparations and are not subject of this article.
Ralf Ludwig
cominform GmbH
Notes:
NotesViewEntry is equivalent to using dblookup, so you need to compare it to the use of notesView.getdocumentByKey which is not great for searching in a view.
To verify the performance of each method, you can create agents, activate profiling for agents, run them and analyse the profiling result.
In your case you already know what to search (the UNID of the document).
You can also use NotewView.FTSearch if the view is indexed.
Jérôme Deniau | 3/26/2008 8:16:39 PM ET