in the last couple of weeks i have had severe performance issues with Keyboard Maestro. Specifically, the issues is with pallets. In takes anywhere between a 2-4 seconds delay between when i issue the hotkey and until the pallet appears.up until a few weeks ago this was instantaneous...
im using latest Keyboard Maestro and latest Catalina. On a new 2020 MBP 13" with 32GB of RAM.
This has caused Keyboard Maestro to become almost unusable...I would really appreciate any help from all of your experience and how to approach debugging this. Any help would be highly appreciated!!
I used to have a kind-of similar issue when the palette had icons, and I had pasted in large icon graphics instead of resizing them down first. I thought this had been resolved, but perhaps not?
yesterday i managed to allocate some time for deep debugging. Turns out the whole issue (at least it seems so) is caused by a cron macro i had running every 3 seconds:
All those tokens you have listed in there are gotten via AppleScript to iTunes/Music. AppleScript is horrendously slow.
The macro running every 3 seconds wouldn't cause much of an issue, even writing a file every 3 seconds wouldn't cause an issue assuming it is an SSD (a spinning disk might have some issues with continuously writing small files, but unlikely).
But continuously accessing AppleScript or worse JavaScript via AppleScript can definitely cause a performance issue.
tell application "iTunes"
--set oTrack to track 1 of library playlist 1
set oTrack to current track
tell oTrack
set trkName to name
set trkArtist to artist
set trkAlbum to album
set trkRating to rating
end tell
end tell
set OTID to text item delimiters
set text item delimiters to linefeed
return {trkName, trkArtist, trkAlbum, trkRating} as text
use scripting additions
use framework "Foundation"
set gTimerStartDate to current application's NSDate's |date|()
tell application "iTunes"
--set oTrack to track 1 of library playlist 1
set oTrack to current track
tell oTrack
set trkName to name
set trkArtist to artist
set trkAlbum to album
set trkRating to rating
end tell
end tell
set scriptResults to trkName & " - " & trkArtist & " (" & trkAlbum & ") " & trkRating
set elapTime to (round (-(gTimerStartDate's timeIntervalSinceNow())) * 1000) / 1000.0
set scriptResults to (elapTime as text) & tab & scriptResults
return scriptResults
Script Debugger
0.01 sec in SD timer
0.006 sec calculated using ASObjC
The AppleScript runs very fast (0.006) when run from either Script Debugger 7 or Script Geek.
But when run from KM the same AppleScript is 10X slower, taking 0.06 sec.
With the total time for the Macro at 7X slower, taking 0.32 sec.
Conclusion
So, Peter, this strongly points to the slowness being due to how KM is executing AppleScripts.
just to clarify (again i am not very technical so maybe im still missing the point ), but what i was issuing was using the built in Keyboard Maestro tokens (https://wiki.keyboardmaestro.com:8443/token/CurrentTrack) and writing them to a text file. I wasn't running any custom Applescripts:
Also: i i have rebooted many times over the past few weeks where i had severe slow downs (until i identified the problem) which didn’t help. Disabling the macro solved this.
i used linux for 15 years and had a similar cron/bash script that did the same with zero lag on the system.