Paintable Canvas - slower/stop repainting

I’m wondering if theres a way to keep the old graphics in a paintable canvas in the repaint function. I see there is a similar topic but I don’t need to actually have this data persist across sessions, just to keep the current graphics on a given repaint cycle. I’m finding that the work I’m doing is slowing down the client because the repaint() method does a lot of work in the background. But, its actually doing the same work more or less every cycle, and for new things, I can probably just set a flag and only repaint it when needed.

Is there a way to pass on the old graphics somehow? Or maybe even just slow the repaint rate?

Repaint doesn’t just happen when property changes trigger or scripts call for it, but whenever Java Swing needs to recompute the visuals. Swing and the operating system try to minimize that with a variety of caching and “damage tracking” algorithms, but you can’t eliminate such calls entirely. They are particularly troublesome when drawing scaled images onto the graphics object. The key to speed is to pre-compute as much as possible – the repaint method itself should never access any data that isn’t pre-loaded into the component’s properties, or at least cached in a persistent python object (possibly using the component itself as a weak key in a dictionary in a project script).

Ah, I was afraid it’d be something like that. Its too bad is read-only, I’d love to just overwrite with the current components actual graphics or something.

I think I can do some pre-computing but thats still going to be drawing a lot of little circles. Currently its calling about 1200 graphics.fill() every repaint… a bit much. I can get that down to about half of that, probably.