BTT is using lots of CPU (11%). When I look at Console.app, I see thousands of instances of
BetterTouchToolScriptRunner: "AppleEvents: received mach msg which wasn't complex type as expected in getMemoryReference.", roughly every ~10ms.
I have 8 TouchBar AppleScript Widgets that poll every few seconds (checking Spotify, etc; my preset is forked from @goldenchaos). When I disable all the AppleScript Widgets, the CPU usage and the logging go away.
If this turns out to be a widget issue, I'll make sure to back-port the fix to my preset I've also been seeing similar CPU usage but haven't been able to identify the issue yet. But maybe that's because it's not an issue with the widgets?
Can you share a screenshot of your BTT Touch Bar preferences?
Update: I re-enabled my widgets one by one while watching Activity Monitor. After re-enabling them all, I'm still seeing the console messages but the CPU seems to be behaving fine.
BetterTouchTool varies between 1% and 6%, and BetterTouchToolScriptRunner and BetterTouchToolAppleScriptRunner are floating around 0.5% - 1.5% (mostly on the low end).
The log messages are normal, it's a bug in macOS 10.13.4-6 but fixed in the Mojave beta. Unfortunately I don't know of a way to prevent them. (it's possible to automatically delete them, but shouldn't be necessary)
There is not much you can do to significantly reducing cpu usage, unfortunately running Apple Scripts repeatedly can be quite bad. The only thing that really reduces it, is increasing the update interval.
Do you have the 6 core i7 or i9 CPU? (in that case the CPU usage display is a bit higher due to how it's calculated).
I'll keep an eye out to see if I can reproduce the high CPU usage; if I do what logs/debugging would be useful? I'd assumed that the CPU was related to the ScriptRunner because that's what I'd seen in the logs, but this may be an independent (and duplicate?) issue, since I didn't see what process was causing it. And I'm glad to hear that Mojave fixes dumb logging issues.
The best way would be to sample the problematic process using this terminal command: sample BetterTouchTool -file ~/Desktop/sample.txt
It's a bit funny how much CPU utilization these 6 core machines show, for example browsing on my old i7 never showed such high CPU values, on my 6 core MBP Chrome and Safari always go above 50% and idle at about 10-15%.
This is because the % value now has 100% per core (and more if Turbo Boost is used). So it can even go higher than 1000% when running stress tests etc. (Running the torture test in Prime95 is funny)
//edit: ah I think it is actually 200% per core because of hyper threading. So the maximum for one process on the 6 core machines should be 1200%
Depending on what widgets you’re using, it might be possible to convert them to shell scripts or even services (push based). This would dramatically reduce CPU and energy usage.
Aside: I’m planning on releasing my test results regarding AppleScript widgets and battery life in the next day or so.