3

With most Xpages applications I observe that, in designer, ssjs libraries are getting slower and slower to open as the grow. One example is library that currently has 1200+ lines of code (including comments) and consists of 40+ functions. Every time I access the library in designer (e.g. by switching from a different tab to the one hosting the library code) there's a lot of flickering, rebuilding and re-reading going on which can take up to several seconds.

It's not that I couldn't wait for that but it makes me kind of uneasy, and I wonder if there is some kind of limitation (regarding lines of code, or number of functions, or both) that I should be observing. Would I be better off splitting my code into various libraries?

And, yes: I am considering rebuilding at least some of the functions as javaBeans, but the base question remains.

And finally, no, I don't observe any degradation in performance at runtime. This is a design-time issue only.

Lothar Mueller
  • 2,528
  • 1
  • 16
  • 29
  • 1
    Switch off "Project / Build Automatically" – Knut Herrmann Sep 01 '15 at 09:38
  • Tried that, but doesn't make any difference. Apart from that: isn't it so that the build process is responsible for compiling xml / ssjs code into java, but not for reading in existing code into the editors? – Lothar Mueller Sep 01 '15 at 09:57
  • It helps definitely if you have XPages with a lot of nested custom controls. It recalculates with activated "Build Automatically" after every single character you write in XPage source code. Wasn't sure about SSJS though... too bad it doesn't help here. – Knut Herrmann Sep 01 '15 at 10:49
  • never mind ;) Primarily I'd like to learn whether there are any known limitations, best practices or whatever helps in this regard – Lothar Mueller Sep 01 '15 at 11:17
  • 1
    FYI - we have found that having build automatically enabled can cause inadvertent issues if someone who is not authorized to sign documents opens the database in designer to even just look at the code because some of the design elements get signed by them. We actually got kicked in the rear on this twice. – Dwain Wuerfel Sep 02 '15 at 03:20
  • @DwainWuerfel: thanks for sharing this; good to keep in mind! – Lothar Mueller Sep 02 '15 at 15:59

1 Answers1

8

The code that builds the 'Outline' tab is causing this problem. I've commented out this code in my development environment and the editor is very responsive even with a SSJS file of +10,000 lines. To answer your question - I'm not aware of any limit on the number of functions, lines of code etc. but there is some inefficient code in Designer that you're experiencing.

I suggest the following workarounds:

  1. Split your code into smaller libraries (as you suggest).
  2. Edit your code with a text editor (not ideal) - Open the Navigator View then right-click on the file and choose - open with - text editor.
  3. When you open the library select the 'Reference' tab while you're working on it. This will stop the outline being refreshed.

In the meantime I'll make a note of this problem and it may be addressed in a future release.

  • many thanks! Yep, I observed the behavioural difference between "outline" and "reference", but I keep forgetting to switch views... - Apart from that: you mentioned commenting out the "Outline" pane; is there a way to do that that we ordinary mortals can go? I'm not too well experienced when it comes to fiddling with eclipse, I'm afraid... – Lothar Mueller Sep 02 '15 at 16:04
  • 1
    Sorry Lothar, there's no way to do that at the moment - it's a code change deep in the bowels of Designer. Maybe we could introduce a preference to disable the outline view in the future. – Gary Marjoram Sep 02 '15 at 16:16
  • ... a preference to define which tab opens by default would be more than fine with me, if that's not already in there (if so it must be well hidden; I just posted a question). Thanks for considering this or something else in this line! – Lothar Mueller Sep 02 '15 at 16:29