Satimage ARM clone released

If you’re like me, you rely on Satimage to extend AppleScript, but with the upcoming macOS 27 eliminating Intel-based apps, that will no longer be an option.

With that in mind, I created a Satimage clone that replicates most of its functionality in a background ARM app. Your scripts should only have to change their use line from use application "SatimageOSAX" to use application "MTC_OSAX".

But more than that, this project also adds features and fixes stuff that wasn’t working in Satimage. You can get all the details from the README of this open-source project.

2 Likes

This looks very interesting! Thanks for sharing.

1 Like

Welcome to the forum @ktekinay

Impressive work, congratulations :+1::clap:

I’m fighting constantly with adopting AppleScript in Swift projects because it clashes all the time with strict Swift Concurrency.

1 Like

This is a lifesaver for AppleScript heavy users. Since it runs as a background ARM app, how does the performance compare to the original Satimage scripting addition under Rosetta? I’ll head over to your GitHub to read the README!

Part of my development process (done entirely via Claude) was several rounds of code quality, security, and performance audits, including benchmarking against Satimage. For the most part, this is on-par or faster than Satimage. Where it’s slower is usually due to more safety processing, and the difference, as a percentage, can be significant, like 2.5x slower or something like that. But in real-world, the actual time is measured in milliseconds, so it did not concern me.

Edit: I just realized you were asking about the scripting addition, not the SatimageOSAX wrapper that also runs as a background app. I only compared the latter.

It’s really impressive that a workflow done entirely via Claude managed to stay on-par or faster than Satimage for the most part. Did you have to prompt specifically for performance optimization, or did Claude handle the quality and security audits well out of the box?

I started with having Claude analyze the Satimage app, explaining that it will no longer be available after macOS 27, and having it come up with a plan. I revised the plan until I was satisfied, then had it start coding in stages, one or two suites at a time. Once it had done all that, I started a new, different agent and asked it to audit for code quality, security, and performance. Once it came up with that plan, I had another agent implement those changes. Then I repeated those two steps. On the third audit, it found only minor issues, so that’s where I stopped.

Recently, based on the sorting conversation here, I asked it to look at the sorting algorithm to see if it could improve it, and it could. Sorting times were cut roughly in half (that’s currently in the develop branch), and then I asked it to implement some other suites. And then I repeated the audit/fix stages until it showed minor issues. That release will come soon.

Claude is like a focussed, mid-to-high-level developer who focusses on a task and sometimes loses the big picture. By managing it properly, you can get some incredible results.

If I may, a basic question about this technique: did you make a specific effort to separate the previous chat, that is so that the new agent wasn’t aware of it? (I guess ‘new agent’ is just a new chat?) Like disabling memory in Claude preferences or creating different projects for these tasks?

Cutting sorting times roughly in half is massive! Was the performance boost mainly from Claude refactoring the logic into native Swift/Obj-C methods, or did it actually switch to a fundamentally better sorting algorithm?

In some cases, I told it to ignore any plans and look at the code with a fresh eye. I didn’t go beyond that.

“New agent” means a new chat, and often a new model (Opus vs. Sonnet vs. Fable).

1 Like

It switched algorithms and made the sorts purpose-built. I asked Claude to summarize its changes, and this is what it came up with:

Faster sortlist

sortlist is much faster on long lists in this version. Sorting a million items now takes a quarter to a third of the time it took in 1.0.1, and an array of real sorts about 16 times as fast. Results are the same as before.

What changed:

  • A purpose-built sort instead of a general one. Before, every comparison went through a chain of general-purpose code. Now numbers and dates are turned into keys that a radix sort can order directly, with no item-to-item comparisons. When you sort by several keys, text is ranked once up front, so the whole multi-key sort can use the same fast path.
  • Text stored compactly. All the text being sorted sits in one block of memory instead of a separate allocation per item. Most texts are put in order by their first few bytes, and only near-ties get a full comparison.
  • Less Apple Event overhead. Much of the old time went into unpacking each list item into its own descriptor and building the result the same way. Lists are now read and written directly from their raw data.
  • Faster number-to-text conversion. Lists that mix numbers and text used to call the system’s conversion once for every number. MTC_OSAX now does that conversion itself, producing exactly the same text, which also speeds up exclude items and keep items.
  • Later tune-ups. Dates sort about twice as fast, numbers mixed with text about a fifth faster, and with respect to stays fast with any number of criteria.

Approximate times for a million items:

List 1.0.1 Now
array of real 275 ms 17 ms
integers 1.27 s 0.31 s
text 1.52 s 0.40 s
numbers mixed with text 3.81 s 0.96 s

Text comparison also improved along the way. Accented letters match however they were typed, comparison 1 ignores case the way SatimageOSAX did (so “ß” equals “ss”), and comparison 4 puts uppercase first by the letters’ case (“Ÿ” before “ÿ”).

I’ve released version 1.1.

1.1

  • sortlist is much faster on long lists: 2.5 to 7 times for lists, and about 15 times for an array of real. exclude items and keep items also compare numbers as text faster.
  • comparison 1 ignores case by full Unicode case folding, as SatimageOSAX did: “ß” equals “ss”, “ς” equals “σ”, and “ff” equals “ff”.
  • sortlist compares text the same however its accents are typed (“é” as one character or as “e” and a combining accent).
  • comparison 4 puts uppercase first by the letters’ case, not their character codes (“Ÿ” before “ÿ”).
  • sortlist of dates is twice as fast, and of numbers mixed with text a fifth faster.
  • sortlist … with respect to takes any number of criteria quickly (one that repeats an earlier one changes nothing, and is skipped), and reads ascending only as far as it’s used.
  • The rest of the Arrays suite (but its hidden commands and the obsolete extractitem), with SatimageOSAX’s bugs fixed.
  • The 3D array handling suite, with isosurface and streamline working as its dictionary describes.
  • sortlist … with respect to returns the lists it sorts by as each would come back sorted alone, as SatimageOSAX did: numbers in a list with text as text, integers in a list with reals as reals.

Thanks for the info.