If you want to sort large string arrays (>1000 items), LotusScript can be horrendously slow. Back in the day, I tried to use Java via LS2J. Unfortunately LS2J was so unstable that I went back to pure LS sorting.
The reason I'm so interested in efficiently sorting arrays, is that I use a token string array as a base when rendering various content in a CMS I maintain at work. Sorting big arrays in LS is, as said, slow. Sorting token string arrays, based on a specific token in LS is s l o w!
Then came Domino 8.5.2, and NotesAgent.runWithDocumentContext :D
Basically, it lets you send an in-memory NotesDocument to an agent (LS or Java), and modify it.
To the demoapp..
In the demoapp, I've created a couple of helpers that lets you sort arrays with the Java API (via a Java Agent). It supports (locale aware) sorting of "regular" string arrays, and token string arrays, based on a token
With 5-600 items in the array, Java beats LS, even when sorting by token. The more items, the bigger the difference.
With 10 000 items, running on my computer:
Java sort: 0.9 seconds
LS Sort (algorithm): 46 seconds
Java token sort: 1.5 seconds
Open the demoapp on the web to run the test on your system. Modify the (SortDemo) agent to test different array sizes.
>> Download DemoApp (demoapp is around 6MB, due to 40k+ documents)
Share and enjoy!