My user has changed the client to 8.5.1 as the company request. He told me that for one function(creat a new form by button),the performance had been terrible. In Notes7, it only needs 20 seconds, but it takes about 3 minutes in Notes8.5.1 client. He has to deal with hundreds of this case ever month, so the performance is unacceptable.
The button is performed as below:
Dim uidocNew As NotesUIDocument
Dim docNew As NotesDocument
Set uidocNew = uiws.ComposeDocument( "", "", "FormName")
Set docNew = uidocNew.Document
(set values for docNew)
docNew.UNID = docNew.UniversalID
Call uidocNew.Save
Dim view As NotesView
Dim key As String
Set view = db.GetView("By_UNID")
Call view.Refresh
key = docNew.UNID(0)
uidocNew.EditMode = False
Call uidocNew.Close(True)
Set docNew = view.GetDocumentByKey( key )
Set uidocNew = uiws.EditDocument( False , docNew )
I’m not sure whether the method used in the button script cause the terrible performance(such as ComposeDocument,EditDocument…), or there’s any other reasons cause the problem.
Anyone knows the exactly reason? And can give me the solution?
Subject: performance
Well, 8.5 is slower in general so it does depend on the speed of the PC, but then it shouldn’t be that much slower
Having said that, what is this code doing? It looks terrible to me. It appears that you’re creating a new document in the ui, saving and closing it, then looking up a view, refreshing that view, getting the doc you’ve just created and reopening it. Why?
If this is what you’re doing, all you need is a button with @command([ComposeDocument];“Form”), the UNID field should be computed when composed with formula @Text(@DocumentUniqueID) and you’re done. Would take about a second to run regardless of the client or PC spec
There may be some other reason for doing what you’re doing but it might be worth explaining it
Subject: RE: why
This button doesnot only creat a new document, but also cpoy some value(include richtext) form current document to the new document, and open it in Read mode. [ComposeDocument] seems open the document in edit mode, so it uses script for saving, closing and reopening. Formula seems difficult to do these.
Subject: Code
Well, without posting all your code I don’t know how you expect anyone to tell you if there are performance differences then
Instead of closing and reopening why not just set to read mode? uidocnew.Editmode = false. No need to close it completely, refresh a view and look it up again.
Subject: RE:code
Thanks. uidocnew.Editmode = false should be enough. But the closing and reopening are the reason for bad proformence? I hope to find out all the reasons, and the solution.
All of the original Code:
Sub Click(Source As Button)
On Error Goto ErrLOG
Dim session As New NotesSession
Dim uiws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Set uidoc = uiws.CurrentDocument
Set doc = uidoc.Document
Dim uidocNew As NotesUIDocument
Dim docNew As NotesDocument
uidoc.EditMode = True
Call uidoc.Refresh
'*----log this action in current document------*
Dim CoMaTimes As Integer
Dim namU As NotesName
Set namU = session.CreateName(session.UserName)
CoMaTimes = doc.ContrManage_Times(0) + 1
doc.ContrManage_Times = CoMaTimes
doc.ContrManage_DT = Now()
doc.ContrManage_By = namU.Abbreviated
Call doc.Save(True,True)
'*----creat a new document and set values to the new document-----*
Set uidocNew = uiws.ComposeDocument( "", "", "Form2")
Set docNew = uidocNew.Document
docNew.Form = "Form2"
docNew.ContrForm = "Form1"
docNew.ContrNo = doc.ContrNo
docNew.WhereUsePGM = doc.WhereUsePGM_010(0)
.
.
.(set many values from doc to docNew including rich text field)
.
.
Dim rtitem As NotesRichTextItem
Set rtitem = New NotesRichTextItem( docNew, "MakeRequestDoc_Link" )
Call rtitem.AppendDocLink( doc, "request link" )
docNew.UNID = docNew.UniversalID
Call uidocNew.Save
Dim view As NotesView
Dim key As String
Set view = db.GetView("By_UNID")
Call view.Refresh
key = docNew.UNID(0)
uidocNew.EditMode = False
Call uidocNew.Close(True)
Set docNew = view.GetDocumentByKey( key )
Set uidocNew = uiws.EditDocument( False , docNew )
Exit Sub
ErrLOG:
Call uiws.Prompt (PROMPT_OK, "ERROR", "ERROR!" & Chr(10) & Str(Err) & ": " & Error$)
Exit Sub
End Sub
Subject: form inheritance
Assuming this is all your code, and all you want to do with the rich text item is to include a doclink to the original document, you can still use formula.
What it looks like you’re doing is just transferring some values from the current doc to the new doc. The easiest way to do this is to use inheritance. Look it up in the help, but you need to set the new document’s form properties to inherit values and then set the field default values to the field names on the ‘parent’ doc
You can also select to copy a link from the parent doc into a field on the new document
If you want to continue what you’re doing I would say that looking up a view and refreshing it would take most of the time, yes
Subject: re:
So formula is faster than script? If I use formula instead of script, the speed would get up in Notes8.5.1? What’s more, “looking up a view and refreshing it would take most of the time”----I think this happens in all notes version, not only Notes8.5.1. Now the performance is so different between Notes7 and Notes8.5.1 client, it means the Notes8.5.1 client take much more time to look up and refresh a view?
If possible, besides soultion,I want to find out the exactly reason for the terrible performance.
Subject: There’s no significant difference in view indexing/opening times.
Subject: Notes performances
Notes 8.5.1 is available in two versions: basic and standard.The basic version should run smoothly on old PC too while the standard version requires a much more performing PC.
We moved from 8.0.1 basic to 8.5.1 standard and we noticed it is slower even on our Lenovo Core2Duo E6550 2.33Ghz and 3GB Ram
Here what IBM recommend, I suggest to multiply by factor 2 :-))
http://www-01.ibm.com/support/docview.wss?uid=swg27016205