Performance issue with DropShadowEffect (macOS Mojave)

I’m seeing some serious performance issues coming from DropShadowEffect. Looks like it’s spending a lot of time in blurDataTriplets.

The component in question is an overlay the size of the main window with a central ‘window’ with the rest transparent. I guess the large size might be an issue here? In any case I don’t remember this being an issue before I upgraded to Mojave.

Unfortunately the blur that JUCE is using is extremely slow. This also affects other things, .e.g the default LAF_V4 PopUpDisplay for sliders that want a popup-display has a shadow.

If this popup-display becomes big enough (lets go crazy and say 400x400 pixels) it gets insanely slow, because the blur-radius for the shadow behind the popup-display is getting quite big.

For my own projects I’ve used a C/C++ version of Mario Klingemans StackBlur algorithm:

I’ve adapted that version to not use multi-threading, but it’s still easily fast enough for real-time usage.

In your case you would need to override some functions in the DropShadowEffect class to utilize the more efficient StackBlur algorithm. I’ve used it directly to blur image data I generate and then cache the result.


I crossed this problem too because I used LookAndFeel_V1, which this use default Image effect for scrollbar and slider.
Switching to LookAndFeel_V2 will specify null effect and solved the issue for me.


NOTE : Using OpenGLContext on top of that made my UI significantly faster.