I’m investigating on a machine with
- Windows 11 25H2
- Intel i7-11700
- Nvidia GeForce RTX 3070
I’m using a plugin with the following editor:
struct Rainbow : public juce::Component
{
void paint (juce::Graphics& g) override
{
const auto colour = juce::Colour::fromHSL (phase, 0.5f, 0.5f, 1.0f);
g.fillAll (colour);
}
float initialOffset = juce::Random::getSystemRandom().nextFloat();
float phase = 0.0f;
juce::VBlankAttachment attachment { this, [this] (auto diff)
{
diff += initialOffset;
phase = + (float) (diff - (int) diff);
repaint();
} };
};
//==============================================================================
class AudioPluginAudioProcessorEditor final : public juce::AudioProcessorEditor
{
public:
AudioPluginAudioProcessorEditor (AudioPluginAudioProcessor& p)
: AudioProcessorEditor (&p), processorRef (p)
{
juce::ignoreUnused (processorRef);
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (800, 600);
for (auto& c : comps)
addAndMakeVisible (c);
}
void resized() override
{
juce::FlexBox fb;
for (auto& c : comps)
fb.items.add (juce::FlexItem { c }.withMargin (1).withFlex (1));
fb.performLayout (getLocalBounds());
}
void paint (juce::Graphics& g) override
{
g.fillAll (juce::Colours::black);
}
private:
Rainbow comps[16];
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
AudioPluginAudioProcessor& processorRef;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAudioProcessorEditor)
};
To test, I’m loading a REAPER project with 16 instances of this editor on-screen simultaneously.
On the develop branch, the editors are a bit stuttery - not quite 4fps like you reported, but visibly slow to repaint. Reinstating the DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT flag definitely helps to make things run more smoothly again.
If I change the number of rainbow components from 16 to 80, then I see the following behaviours:
- develop branch: dragging plugin editor windows is a bit stuttery, repaints are slow.
- develop branch with WAITABLE_OBJECT reinstated: very similar to plain develop.
- 8.0.12: REAPER fails to load the project completely, and seems to hang after opening all editors. I guess the main thread gets swamped with repaint work, preventing other messages from getting processed.
This seems to be the reverse of what you reported. For me, 8.0.12 is unusable with several heavy editors showing, but develop is much smoother.
I also tried adjusting the Rainbow component to call its repaint() on a timer at 500Hz, but this didn’t seem to have any appreciable performance impact. paint still seems to get called once-per-vblank, so I think the coalescing is working as intended.
Do you have any idea what could be different between my test scenario and yours? Maybe the host has an effect. Which hosts are you using for testing? Do you see the same behaviour in all hosts you’ve tried?
Please could you test out the editor code I provided, and check what results you get on 8.0.12 and develop? If my test plugin is slow on 8.0.12 but fast on develop, then that probably indicates that there’s something specific to your plugin that is causing the inverse behaviour. Otherwise, if the test plugin is fast on 8.0.12 and slow on develop (i.e. the same as your plugin) then that might indicate that the problem is related to your specific hardware, DAW, or some other aspect of your environment.