Speed Test for Find Image Macro (v11.0.1)

Speed Test for Find Image

NOTE: The revised version by @griffman, further down, is probably better.

My previous Macro, "Speed Test for OCR" was pretty successful. It has become apparent that I also need a "Speed Test for Find Image." So here's a macro that does that. I used the same format and prompts that my previous macro used.

Speed Test for Find Image Macro (v11.0.1)

Speed Test for Find Image.kmmacros (223 KB)

Here are my results. The main thing to notice here is probably "Apple M3." The other stats are probably not as important regarding this speed test. As far as I know, the Performance CPU(s) is the throttle for this test. But I'm curious to see what other people with more GPUs get.

24-inch, 2023;macOS Sonoma;Apple M3;24 GB;Version 14.1.2;24-inch (4480 Γ— 2520);27-inch (2160 Γ— 3840)
Total Time: 0.27145377 seconds per run

My result is very similar to yours:

Apple M2;24 GB;macOS Sonoma;Version 14.2;27-inch (3840 x 2160)
Total Time: 0.2476317 seconds per run

I'm not sure yet if it's...
(a) the type/speed of the CPU,
(b) the number of CPUs or
(c) the number of GPUs (for Mx Macs)
...that determines the speed of Find Image.

When I wrote this macro I didn't know how to determine "the number of GPUs" but now I can tell (for my Mac at least) you it's under System Settings / General / About / System Report / Hardware / Graphics.

According to this, on my Mac the number of GPU cores is 10. Based on your results, I'm guessing that you have more than 10.

Nope, I have ten cores too according to that system report:

Chipset Model: Apple M2
Type: GPU
Bus: Built-In
Total Number of Cores: 10

It's a very small difference between our results, and I'd guess it's possible that repeatedly running your macro could give slightly different results depending on what other things the MAC is doing at the time.

1 Like

Very cool test, @Airy!

Here are my results:

Model Name           : Mac Studio (Mac14,14 β€’ Z1800003ULL/A)
Chip                 : Apple M2 Ultra
Cores                : 24 (16 performance and 8 efficiency)
Memory               : 64 GB
macOS Version        : macOS 13.6.1 (22G313)
GPU                  : 60 cores [Apple (0x106b)]

S27C900P Display     : 5120 x 2880
DELL P2715Q Display  : 5120 x 2880

Total Time           : 0.20369832 seconds per run

Also, as might be evident above, I played with the macro a bit :).

Speed Test for Find Image - revised.kmmacros (242 KB)

I figured if people were going to post results, it might be nice if it were a standardized format. This version avoids the GUI and uses the built-in system_profiler command to collect the system info. I find this less visually jarring than the GUI method, and it's much quicker.

It's just a few repeated calls to get hardware, software, and display info:

$ system_profiler SPHardwareDataType | head -n 10 | tail -n 6  #model, chip, cores, RAM
$ system_profiler SPSoftwareDataType | grep System\ V          #macOS version
$ system_profiler SPDisplaysDataType | grep -A 1 of\ Cores:    #GPU information
$ system_profiler SPDisplaysDataType | grep -B 1 Resolution:   #Attached displays

Then I play with each of those with regex to make them easier to read, and later (just before the copy to clipboard option), a ChatGPT-created Perl script spaces the columns appropriately. I then add the forum code block tags before copying to clipboard.

(This could be done with one call to return everything from system_profiler, but the regex processing is then really complicated and overly involved. Four calls goes very quickly, and makes for very simple regex.)

Feel free to use any/all/none of that as you wish in the official macro. In the attached modified version, my changes are colored teal.

-rob.

2 Likes

Here are my results:

Model Name            : iMac
Model Identifier      : iMac19,1
Processor Name        : 8-Core Intel Core i9
Processor Speed       : 3.6 GHz
Number of Processors  : 1
Cores                 : 8
macOS Version         : macOS 14.2 (23C64)

Display Type          : Built-In Retina LCD
Resolution            : Retina 5K (5120 x 2880)
ipcolor Display       : 3840 x 2160

Total Time            : 0.14682857 seconds per run

There's a winner. I was expecting Intel to win second place.

Here are my results:

Model Name       : iMac (iMac21,1 β€’ Z12T000PRLL/A)
Chip             : Apple M1
Cores            : 8 (4 performance and 4 efficiency)
Memory           : 16 GB
macOS Version    : macOS 14.2 (23C64)
GPU              : 8 cores [Apple (0x106b)]

Display Type     : Built-In Retina LCD
Resolution       : Retina 4.5K (4480 x 2520)
HISENSE Display  : 3840 x 2160

Total Time       : 0.48702489 seconds per run

Here are my results:

Model Name       : Mac mini (Macmini9,1 β€’ Z12P000KKLL/A)
Chip             : Apple M1
Cores            : 8 (4 performance and 4 efficiency)
Memory           : 16 GB
macOS Version    : macOS 14.2 (23C64)
GPU              : 8 cores [Apple (0x106b)]

Display Display  : 1920 x 1080

Total Time       : 0.11446387 seconds per run

Here are my results:

Model Name            : iMac
Model Identifier      : iMac18,3
Processor Name        : Quad-Core Intel Core i5
Processor Speed       : 3.8 GHz
Number of Processors  : 1
Cores                 : 4
macOS Version         : macOS 14.2 (23C64)

Display Type          : Built-In Retina LCD
Resolution            : Retina 5K (5120 x 2880)

Total Time            : 0.16058225 seconds per run

Here are my results:

Model Name            : MacBook Pro
Model Identifier      : MacBookPro16,1
Processor Name        : 8-Core Intel Core i9
Processor Speed       : 2,4 GHz
Number of Processors  : 1
Cores                 : 8
macOS Version         : macOS 13.2 (22D49)

Display Type          : Built-In Retina LCD
Resolution            : 3072 x 1920 Retina

Total Time            : 0.10728561 seconds per run

I think the issue is that the number of pixels to process greatly affects the results. I disabled my second 4K display, and ran the test again:

Total Time        : 0.11202112 seconds per run

Then I ran it again after setting the resolution to 1600x900:

Total Time        : 0.09634621 seconds per run

I'd get a really fast time if I could set it to 640x480 :).

It seems that we'd need to change the test in one of two ways:

  • Open a standard wallpaper found in /System > Library > Desktop Pictures in a window at a fixed resolution that would work on most Macs (1200x800?), and then only process that window.
  • Calculate the total number of pixels processedβ€”in my usual case, that's 5120 x 2880 x 2 = 29,421,000β€”and use that to standardize the results on a "processed per second per pixel" basis, or something like that.

-rob.

1 Like

I may be seeing a pattern. Higher screen resolution makes slower Find Images. That makes sense.

1 Like

And mine:
Here are my results:

Model Name            : iMac
Model Identifier      : iMac14,2
Processor Name        : Quad-Core Intel Core i7
Processor Speed       : 3.5 GHz
Number of Processors  : 1
Cores                 : 4
macOS Version         : macOS 13.6.1 (22G313)

Display Type          : LCD
Resolution            : 2560 x 1440 (QHD/WQHD - Wide Quad High Definition)
DELL 2001FP Display   : 1600 x 1200

Total Time            : 0.20571389 seconds per run

Makes allot of sense. But could it not also make sense to have the macro set the individual Mac's screen resolution before the test starts, and reset it again after it's done? (That said, when testing the new Set Screen Resolution action, for the first time, here now, I am actually not able to make it work. It makes noe change at all to the screen resolution.)

Seeing these results is interesting, not just for the numbers, but because it's clear system_profiler returns data in different formats on different Macs! I'm happy my regex is actually still working for those, but the differences are interesting.

My Mac generated this output:

Model Name           : Mac Studio (Mac14,14 β€’ Z1800003ULL/A)
Chip                 : Apple M2 Ultra
Cores                : 24 (16 performance and 8 efficiency)
Memory               : 64 GB
macOS Version        : macOS 13.6.1 (22G313)
GPU                  : 60 cores [Apple (0x106b)]

But @tiffle's generated this:

Model Name            : iMac
Model Identifier      : iMac14,2
Processor Name        : Quad-Core Intel Core i7
Processor Speed       : 3.5 GHz
Number of Processors  : 1
Cores                 : 4
macOS Version         : macOS 13.6.1 (22G313)

No GPU info, and different CPU/chip details. At first, I suspected the macOS version, but we're both on macOS 13.6.1, so that's confusing.

If I can get some sample data, I can probably revise the regex to handle the difference. @tiffle and others, if you could direct message me with the results of this Terminal command, it'd be great!

(system_profiler SPHardwareDataType && system_profiler SPSoftwareDataType && system_profiler SPDisplaysDataType) | pbcopy

Just run it, and the results will be on your clipboard. Open a direct message to me, paste, send, and thanks in advance!

-rob.

It would, but sometimes when you switch resolutions and switch back, windows can get messed up. I think a "per pixel per second" approach might be best. I'll take a look later, but busy for a couple hours now.

-rob.

Looking at the "per pixel" measurement turned out to be quite the wormhole, mainly because System Profiler doesn't know anything about retina displays. As such, its pixel values were always way too highβ€”higher than the native limit on my 4K display if I used a resolution that gave me "more space."

So I went looking for a way to get the actual resolution, and the only way I could find was through a series of screenshots: Take one per display, and Spotlight records the apparent resolution of each display in the metatada.

NOTE: You may find that the macro hangs on the progress bar that says it's waiting for Spotlight results. If that happens, you'll need to grant Terminal Files & Folders permission to access your Desktop folder in System Settings > Privacy & Security > Files & Folders. (Or you can give it Full Disk Access.)

NOTE 2: Spotlight is required for this test to run. It was the only way I found to get the actual resolution of each display.

The attached version of the macro will try to do just that: Take a series of screenshots covering your connected displays (up to 10), and then it runs the test and reports a final score on a "per pixel" basis.

Speed Test for Find Image.kmmacros (306 KB)

Using this new version of the test, here are my results:

Model Name                β”‚  Mac Studio (Mac14,14)
Chip                      β”‚  Apple M2 Ultra
Cores                     β”‚  24 (16 performance and 8 efficiency)
Memory                    β”‚  64 GB
macOS Version             β”‚  macOS 13.6.1 (22G313)
Keyboard Maestro version  β”‚  10.2

GPU                       β”‚  Apple M2 Ultra (60 cores)
Display                   β”‚  S27C900P
 Current resolution       β”‚   2560 x 1440 (3,686,400 pixels)
Display                   β”‚  DELL P2715Q
 Current resolution       β”‚   2560 x 1440 (3,686,400 pixels)
Total pixels              β”‚  7,372,800

Test Details              β”‚  100 tests in 20.35 seconds (0.2035 secs/test)
──────────────────────────│─────────────────────────────────────────────────
Find Image On Screen      β”‚  36,237,019.8 pixels per second

I don't know how well this test will work for anyone else, but (with the proper permissions), it ran fine on all three of my Macs here. Oddly, only one required that I actually grant the permissions, so I'm not sure what triggers that.

-rob.

Here are my results:

Model Name                β”‚  iMac (iMac19,1)
Processor Name            β”‚  8 Core Intel Core i9
CPU                       β”‚  3.6 GHz (1 CPU, 8 cores)
Memory                    β”‚  40 GB
macOS Version             β”‚  macOS 14.2.1 (23C71)
Keyboard Maestro version  β”‚  11.0.2

GPU                       β”‚  Radeon Pro 580X
Display                   β”‚  iMac
 Current resolution       β”‚   2560 x 1440 (3,686,400 pixels)
Display                   β”‚  Rec. ITU R BT.2020 1
 Current resolution       β”‚   1920 x 1080 (2,073,600 pixels)
Total pixels              β”‚  5,760,000

Test Details              β”‚  100 tests in 14.84 seconds (0.1484 secs/test)
──────────────────────────│─────────────────────────────────────────────────
Find Image On Screen      β”‚  38,801,499.8 pixels per second