We just switched to the newest JUCE 7.0.3.
And we are seeing a slowdown in the function
ValueTree::readFromStream(). That function lets you load a value tree from disk (through an input stream).
We have quite a large value tree we are loading during startup (to restore the state of our application). In JUCE 7.0.2. it took about 1 second to load the file. But in JUCE 7.0.3 it takes about 15 seconds. So JUCE 7.0.3 is about fifteen times slower. That’s a bit of a road block for us.
We did a bit of debugging and found the reason for the slowdown. It’s a change in
MemoryOutputStream::writeFromInputStream, which is internally used by
ValueTree::readFromStream(). There was a change made to the number of preallocated bytes:
I assume it allocates more bytes now? Because what I can see is that the destructor of
MemoryOutputStream takes a lot longer to run in JUCE 7.0.3.
If I revert the change in
MemoryOutputStream::writeFromInputStream then our slowdown is gone.
We were testing on the RELEASE version of our application. To make sure it’s not a debug only problem. (In debug the difference is actually less pronounced, but still noticeable.)
The test system was a Mac M1 Pro running macOs 12.6 and Xcode 13.4.1.