• Performance tuning

    By Niels Johnson 2 decades ago

    Great app and thanks for sharing it.



    I have one question I found when using OpenLog with respect to performance tuning my application. I have an agent that uses several script libraries. My agent, as well as all my script libraries use the OpenLogFunctions script library. The OpenLogFunctions library, Dims a session object each time it is initialized, which is a heavy object and ends up being created several times. One for the agent, another for OpenLogFunctions from the agent, and several more for each one of my referenced script libraries (as I use logging in all my script libraries as well). My questions is, am I missing something or is this the way it is suppose to work. If so, isn't this inefficient, initializing the same session an db objects multiple times and using up system memory? Performance tuning my applications is important part of my development and I always try to get the most out of every bit of memory and processor cycles. I'm not trying to be critical, just want to make sure that I have implemented it correctly.



    Thanks for any help/comments you may have.

    • I haven't noticed any performance issues myself

      By Julian Robichaux 2 decades ago

      Actually, a NotesSession doesn't end up being a "heavy object" at all. The following lines of code don't have any impact whatsoever with regards to object creation:



      Dim session As New NotesSession

      Set db = session.CurrentDatabase



      That's because the session and the current database objects are actually created when an agent starts, and whenever you set a variable equal to either of those objects, you're just getting a reference to the existing object in memory, not creating a new one (despite the syntax of "New NotesSession"). I learned this one year at Wai-Ki Yip's Lotusphere session AD104: LotusScript Tips and Tricks



      http://www-10.lotus.com/ldd/sandbox.nsf/ByDateNJ/68797abc4efa809a85256e51006a2c8a?OpenDocument



      As far as I'm concerned, if Wai-Ki Yip says it's so, then it's so. And I've definitely included some efficiencies in the code, like only getting a handle to the OpenLog database after the first error, and then reusing the object reference (along with many others) afterwards.



      Naturally, if you're concerned about performance, you should definitely run some benchmarks as you're testing the code. I would just say that you shouldn't assume that something is going to be a bottleneck until you've tested it.



      Good luck!


      • Julian
      • Thanks Julian

        By Niels Johnson 2 decades ago

        Thanks for responding to my question so quickly. The issue of the session simply being a reference rather than a new object was very helpful, and I learned something new.



        Thanks,

        Niels