AppleScript runs 27 times slower when run from Menu Bar than from Script Debugger or Script Editor

Am running a script that gets a persons name from the Contacts App and puts it in cells in a Numbers table. The script takes about 1 second to run from either Script Debugger or Script Editor. When I run the script from the Menu Bar, it takes 27 seconds consistently. I have another script that builds an invoice worksheet in numbers and accesses the Contacts App to get customer information. it runs at the same speed from the Menu Bar as from the Contacts App. This issue is occurring on an M2 Mac Mini running Sonoma 14.4.1. I have run the same script on an M1 Mac Studio under Sonoma 14.4.1 from the Menu Bar it runs in about a second as expected. So - I have no idea how to remedy this issue when running the script from the Menu Bar on the M2 Mac Mini. I can supply the script if requested.

I believe improved performance is a feature of Red Sweater’s FastScrips:


I tried to measure the AppleScript execution speed of Script Menu on macOS 14.5beta3 running on Mac mini M1.

The test script does not operate the application. I tried to process Permutations, which completes the process within the scope of AppleScript + Cocoa. It performs permutation-combination calculations of a one-dimensional array with a specified number of elements.

It is reminiscent of a bug that caused AppleScript to run on the M1 E-core on macOS 11, which significantly slowed down AppleScript execution.

SED=Script Editor
MEN=Script Menu

6 digits
SED: 0.099387049675 seconds
MEN: 0.515756964684 seconds

7 digits
SED: 0.501626014709 seconds
MEN: 3.565899968147 seconds

8 digits
SED: 33.727347016335 seconds
MEN: 263.738371968269 seconds