JUCE
JUCE copied to clipboard
[Bug]: String append performance problem
Detailed steps on how to reproduce the bug
despite of have preallocateBytes function when call append operation operator+= this preallocated space is not taken in consideration. causing calling allocations each time then use a String appending information continuously is time consuming. I use std::stringstream instead as workaround but append should take in consideration if space is enough to just append without reallocate memory and improve performance in use of strings preallocating space if string would be modified constantly with append operations.
I try to patch using getAllocatedNumBytes but I realize this is not returning me expected value.
What is the expected behaviour?
If user preallocate enough space string wouldn't reallocate space each time.
Operating systems
macOS
What versions of the operating systems?
Found on Mac but I think it happens in all since this comes from core
Architectures
64-bit
Stacktrace
No response
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
I have not tested against the develop branch
Code of Conduct
- [X] I agree to follow the Code of Conduct