Make LS run faster

Hi all,

When comes to the performance, many people suggested to rewrite modules in C. It seems it is the only way(and hard way~~).

Is there any other way that simply to make LotusScript run faster?

I heard a rumor(from an LS expert) that LS can be compiled and called as compiled library for better performance. Is it true?

Subject: Make LS run faster

LS is really not that slow, usually the slowness is caused by bad programming. Also disabling database and view updates improves speed: NotesView.AutoUpdate=False and NotesDatabase.DelayUpdates=True. Also avoid using GetNthDocument and StampAll, since GetFirstDocument+GetNextDocument is faster. Avoid also using the + operator to merge strings, as & is faster in LS (in VB + is faster than &). When you have to update many documents, make sure that at least one field has changed before saving the document. Saving documents without checking if the fields are already same on disk, causes the biggest slowdowns.

You can also map a 2GB RAM disk and let the server replicate the databases there, and let the users use them from the RAM disk.

Transaction logs slows down performance a lot, so don’t use them for heavily updated databases.

You can also call C API functions from LS agents to speed up LS agents for certains things.

LS can read/write approximately 5000 documents per second, on a normal windows OS. Under Linux you might get about 60% faster performance.

R5 and R6 up to 6.0.2CF2 are also faster than 6.0.3-6.5.4 (IBM has identified this problem and a fix should be soon out), and R7 is again faster than R5/R6.

Executable C API programs are faster than LS agents, but Java agents are exactly the same speed as LS agents. Formula language is also faster than LS/Java, but slower than executable C API.

Subject: RE: Make LS run faster

Hi Mika,

Really thanks for your valuable advices! ^^

As our boss said the performance of Notes is getting poor, his asked us to find ways to improve the performance without any hardware upgrade(No budget!)…

We have 300+ Databases. It seems it is impossible to rewrite all the modules into C as we have a little C/C++ programming experience…

I will try all the suggested good stuffs.

Have u heard about LSS?

Does LSS improve performance?

Thanks

Sam

Subject: RE: Make LS run faster

LSS is a text file containing LotusScript source code. It is %Included into LotusScript code at compile time, and has no effect on performance (as far as the application is concerned, it’s like you types it directly into Designer).

You may be thinking of LSX or the LotusScript Extension architecture, which allows you to write C libraries that can be called from LotusScript. That can be a good choice if you need to perform the same operatons over and over and can’t find a way to optimise your LotusScript.

Frankly, though, there is an awful lot that can be done to speed up LotusScript without moving out of the language at all. Start by making sure that GetNthXXX is never used to iterate through collections or walk views. Use GetFirst/GetNext or GetLast/GetPrevious instead. That takes the big O complexity down from n*n to n. If you are using Redim Preserve in a loop, you’re probably doing something wrong – use a List instead. If there are bubble sorts in your code, use a shell sort instead – it’s hugely quicker. Never open documents if you don’t have to – use view column values to read and StampAll to write whenever possible.

All of those things (and several others you’ll see in this and the R4 & R5 forum, including using Formula Language when appropriate, limiting the number of views in the database, and so on) will have a bigger impact than writing equally inefficient code in C or C++. And they’re a heck of a lot more maintainable.

Subject: RE: Make LS run faster

“Transaction logs slows down performance a lot, so don’t use them for heavily updated databases.”

Sorry, but this is patently untrue unless you’ve done something plain silly, like put your translog on the same platter as your data drive.

Subject: RE: Make LS run faster

Nope, I tried everything, default settings, different sizes for the log, and it was also on a seperate physical harddrive.If you do an LS agent which writes for example 300000 documents in a new database, it goes much slower when the database has transactional logging enabled than without.

I think the only thing which is faster with transactional logging is the view indexing, but a good LS document creating/changing agent will index the view before users need to index it.

Subject: RE: Make LS run faster

I’ve experienced significant performance gains by a properly configured transaction log. So has IBM.

Subject: RE: Make LS run faster

Then there must be some settings which either make transactional logging faster or slower than without it.

Subject: RE: Make LS run faster

Is it related to this Notes.INI setting?

http://www-1.ibm.com/support/docview.wss?rs=0&q1=DEBUG_LOGGER_BUF_FULL_NO_WAIT&uid=sim4c42c6f3976c6281785256f25004d13c4&loc=en_US&cs=utf-8&cc=us&lang=en