Joining Strings takes very long to compile since Visual Studio 16.9.0 update

Since Visual Studio 16.9.0 (and 16.9.1), joining Strings takes extremely long to compile; tested with current JUCE master. Compilation takes minutes to hours for something like this; it takes longer the more Strings you add:

const juce::String foo = juce::String("Foo") + "Foo" + "Foo" + "Foo" + "Foo" /*+ .. add a dozen more here*/ ;

It’s all fine if you write this instead:

const juce::String foo = std::string("Foo") + "Foo" + "Foo" + "Foo" + "Foo" /*+ .. add a dozen more here*/ ;

Or this:

juce::String foo = juce::String("Foo");
foo += "Foo";
..

JUCE team, can you look into this? Thanks!

Maybe the Visual Studio team should be the one to look into that as surely this won’t just affect juce::String. But thanks for the warning… I won’t update Visual Studio for now.

Have you tried concatenating with << ?

Thanks for the idea! So yes, concatenating with << is fast.

As a test, I’ve just replaced all instances of the + operator in juce::String to return an empty String. Such as:

JUCE_API String JUCE_CALLTYPE operator+ (char s1, const String& s2) { return ""; }

And then I call this:

const juce::String foo = juce::String("Foo") + "Foo" + "Foo" + "Foo" + "Foo" /*+ .. add a dozen more here*/ ;

As soon as I have more than about 20 + here, it will take minutes to compile and will require gigabytes of memory. I’d like to send that to the Visual Studio team, but before that - does anyone have an idea what could be the cause here?

Just FYI: The issue still persists in the current Visual 16.10.1.