>From my brief interactions with making prs for tk, my impression was that Wish development on macos isn't very healthy.
Probably partly due to MacOS changing APIs all the time and leaving developers to figure out how to migrate in the best way.

There are a few different threads regarding performance issues with recent wish and MacOS, but unless someone investigates it and opens up a ticket with Tk to fix it it probably won't get fixed.

Tcl/tk that isn't recent has some little things that don't really work on macos, so there's really nothing to be done on the pd side aside from switching to another gui toolkit entirely.

-seb

Date: Thu, 13 Jul 2023 23:22:10 +0200
From: Roman Haefeli <reduzent@gmail.com>
To: pd-dev@lists.iem.at
Subject: [PD-dev] performance of different Wish versions
Message-ID: <1d9d56e5434211950cc1b1b363d84af42ff3b7f9.camel@gmail.com>
Content-Type: text/plain; charset="utf-8"

Hey all

I was seeing a suspiciously high CPU usage (~52% in Acitivity Monitor)
on macOS with one of my patches basically idling. It turned out to be
the GUI process and not 'pd'. Then I figured out that it was related to
frequently changing the color of a [cnv] in a GOP. The same patch with
the same rate of color changes eats almost no CPU on Linux (4-5% in
htop). 

Because of lack of better ideas, I tried to build a Pd-0.54.0.app based
on different Wish versions. On macOS 12.1.6 (Monterey, the only version
I have currently access to), I was able to create the following Wish
versions with the help of the tcltk.sh script that is part of the pure-
data repo:

  - 8.6.11
  - 8.6.12
  - 8.6.13

8.6.10 doesn't seem to build on macOS 12, so I didn't try smaller
versions.

The biggest difference between different Wish versions I got with the
patch flat-gops-refreshing-often.pd. When turning on the [metro] and
let a signle GOP square blink by clicking into the light green area,
those are the CPU usages I see with different Wish versions / Pd 0.54-
0:

  - 8.6.12 67%
  - 8.6.13 65%
  - 8.6.11 %6

Yeah, in this particular test, 8.6.11 is 11x faster than 8.6.12!

With some other tests the differences are less pronounced. When
flickering a [cnv] directly in the patch (not GOP), all versions show
similar CPU usages. With another patch (not included), 8.6.13 is
clearly better than 8.6.12, but still beaten by a wide margin by
8.6.11.

The unusual high CPU usage seems related to GOP usage. The flat-gops-
refreshing-often patch holds many instances of a GOP abstraction. It
performs badly even the other GOP instances are not flickering.
However, when number of idling GOP abstractions is reduced, the
flickering instance eats much less CPU.


Miller's 0.54-0 release apparently uses 8.6.12 which - according to my
tests - performs the worst of the three tested versions.?

This is my test env:
  - Pd 0.54-0 (built with 'make app')
  - macOS 12.6.3
  - Wish/TclTk
    - 8.6.11
    - 8.6.12
    - 8.6.13

My test builds and some test patches are included here:
https://netpd.org/~roman/tmp/wish-speed-macos.tar.gz


Cheers
Roman