OK, this is probably due to the way applescript handles extremely large lists, but I copied the script below from MacScripter (linked to from another thread here) and ran it in debugging mode a couple times. Each time about 10 seconds into execution the script hung and SD became unresponsive and had to force quit.
No crash reporter on relaunch.
Seemed to run fine with debugging turned off.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
-- build list of 100,000 reals
set theList to {}
repeat 10000 times
set end of theList to random number from 0.0 to 100.0
end repeat
set newList to {}
repeat 10 times
set newList to newList & theList
end repeat
-- sort them
set theStart to current application's NSDate's |date|()
set anArray to current application's NSArray's arrayWithArray:newList
set newList to (anArray's sortedArrayUsingSelector:"compare:") as list
set timeTaken to -(theStart's timeIntervalSinceNow())
Here’s the SD Forum topic:
sorting-lists-in-a-list-using-applescriptobjc/1278/4
And this is where the sample came from:
MacScripter / How to sort a list of records by a specific property