I have a script that takes 15 seconds to run. It’s doing a bunch of search-and-replace operations in BBEdit. I made a TINY modification to the script and all of a sudden it took 20 seconds.
So I commented out my changes, and ran the script again. Still 20 seconds.
I threw away my modified script and ran the original. Fifteen seconds. Duplicated it in the Finder, and ran the duplicate: 15 seconds. Opened the duplicate, did a Save As… and ran that one: still 15 seconds.
This is all under Ventura 13.2.1 and Script Debugger 8.0.5.
So now I open up one of the duplicates, add a COMMENT, save the script, and… it takes 20 seconds to run.
I get the same thing with Script Editor. And all I am doing is adding two hyphens as a comment.
The original script was probably compiled 5 years ago or so, possibly on High Sierra or Mojave.
How can I bring back the speed? This is vanilla AppleScript, no libraries or AppleScript Objective-C.
Thanks for this. The scripts are typically run from the BBEdit scripts menu, but I’ve run the scripts a few other ways also. If I run them from Script Debugger, the one where I’ve recompiled under Ventura is slower than the one that was compiled on an older system by 5 seconds (20 seconds vs 15). If I run the compiled scripts from the Scripts menu in BBEdit it’s the same story. If I run the compiled scripts from Fast Scripts it’s also the same story-- 15 seconds for the original, 20 seconds for a copy of the script (duplicated in the Finder) with a single two-hyphen comment added. Just the two hyphens, nothing more! The script was originally compiled about 5 years ago so that could have been macOS 10.12.
@christianboyce
Its little difficult to know what happen to your script without a sample.
But You could set return statement anywhere in your script code to find where it begins to become slow. If you use repeat loops you could make script object. If your script use
Finder to get contents of files and subfolders (AppleScriptObjC is faster)… and so on…
Also a reboot of the system machine could also help, when Scripts become slow or behave in a way that is not normal.