Frame Rate Drops Significantly when Plugin is Active

Basically having the same issue again recently. I’m on a MBP 2017 Pro, running macOS Big Sur 11.6.1 (20G224), GA 3.2 (3190).

If I activate any plug in that’s drawing something on the canvas, such as GitHub - weiweihuanghuang/ShowCrosshairOnSelect: Glyphs plugin for displaying a crosshair or GitHub - weiweihuanghuang/Show-Distance-And-Angle-Of-Nodes-In-Corner

The frame rate (according to Quartz Debug) drops from 25 to 15 and becomes really laggy.

What version of Python and pyobjc do you have?

Using Python 3.9.1 (Glyphs), ObjC 7.1

Can you remove and re-install the Glyphs python? That should give you python 3.10 and pyobjc 9.0.1.

I did that and now have Python 3.11.3, ObjC 9.0.1
It’s still slow.

Another weird thing which I don’t know if it’s related I noticed when zooming, the lines seem to bounce, or the vertical and horizontal aren’t zooming at the same rate or something (this is with all plugins off):

Can you try it with a only a few lines of text? Or even only a few glyphs?

Doesn’t happen with a few glyphs, refresh rate hits mid 30s, for a few lines, it drops to low 20s, then a paragraph it goes back down to ~15.

Any ideas?

Not really. Just that I would suggest to use less text in the edit view.

I think I discovered one of the culprits that was slowing down Glyphs App performance:

Uninstalling this improves my frame rate.

Interesting. The plugin should be doing close to nothing when the Control key is not held down, but I can have a second look.

I find that even my other plugins that when they are doing nothing slows down the panning and scrolling.

That is a drawback of the pyobjc bridge. Can’t do much about that.

I’m coming back to this problem to ask whether it’s possible write plugins in a way that doesn’t slow down the framerate: even when nothing is being drawn just having a plugin active slows down glyphs app whenever there is more than a few lines of text?

You need to write a plugin without python, meaning it needs to be written in objectivC or swift.

Do you have a specific plugin in mind? Perhaps the Python code can be modified to stop processing sooner when the plugin has nothing to draw.

There is a quite big overhead just calling into python. That on its own can cause a slowdown. But looking at the specific code might help, too.

This is the plugin I use most that I have to turn on and off all the time

I trimmed the code down and made the calls more efficient (haven’t published) but the performance is more or less the same.

I had a look a the plugin and changed it quite a bit. Hopefully I didn’t break anything.
But it is MUCH faster now.

1 Like

Wow it’s so much faster! Thank you Georg.