If your daily grind includes maintaining even moderately complex HCL Domino apps of the, err, traditional variety, then you likely spend some of your time monkeying around with LotusScript code. If that’s the case, and you ever run into complaints from users about application performance, then you may have come across Teamstudio Profiler. If you haven’t, I’m here to tell you that this is the world’s first and only performance profiler for LotusScript code. Yes, we know this tool will probably appeal to a relatively select group of individuals but also, it’s one of those, “when you need it, you really need it” situations.
So how does it work, or more specifically, how do you read the output and make sense of it? It’s actually pretty straightforward, to the point that I’d say that Profiler, despite the complexity of what it does, is actually one of the easiest tools to use. Once Profiler’s installed into your Notes client, you just open the application you want to profile, click the smarticon to fire it up, run the troublesome bit of code, and then hit the Profiler icon again to see the results. That’s all there is to it.
The top pane in the Profiler window shows a list of the LotusScript functions that were run during the profiling session. This is presented as a table that, for each function call, shows the function name and the number of times that function was called. “Time + Children” indicates the total time taken by that function and all of its children, whereas the “Time” column shows just the time spent in the parent function itself. The “% Parent” column is usually the most telling. It shows the percentage of the time taken by the parent function that this function used. In graphical form, it gives you a quick indication of which functions take the most time. So clearly, if you’re looking for a performance bottleneck, this is a good way to zoom in on the likely culprit.
As you click on the functions in the top pane, you’ll see the results for that function’s children show up in the pane below.
Note that child functions do not include built in LotusScript language functions such as Print or Message Box. They also do not include Product Classes such as NotesDocument or NotesDatabase. You can use the arrow buttons at the top of the lower pane to navigate between levels of child functions. To dig into the detail of a function, select the Source tab in the lower pane. This will show you, line by line, the timings that make up the total for the function.
The Call Tree window can be used as an alternative way to navigate through your code. This gives you a structured view of the functions in your application as they are called. The Combine Children checkbox can be used to combine all calls to the same function into a single line. So, for example, if a function is called 100 times in your profiled application, you would see 100 entries for that function in the call tree. If you select Combine Children, they will be compressed into a single line.
And that’s it. Typically you are looking for one or more lines of code that are causing the bottleneck. This could be times when you are refreshing a view or saving a file. Oftentimes, putting some thought into restructuring the code (taking a file save out of a loop, for example) can pay dividends in terms of the user experience. While there are no guarantees, a tool like Profiler will help you quickly zoom in on where the trouble spots are, and hopefully give you some ideas on how to resolve them.
To learn more about Teamstudio Profiler, click below.