The += 16 used before is too abstract.
-If NewPattern is longer than 16, StringBuilder must be re -permitted again. -If NewPattern is shorter than 16, you will be assigned a memory to StringBuilder.
For this reason, we request optimized code that allocates memory equal to the length of NewPattern.
There is also a possibility that the length of the ++ NewPattern will be abnormally longer, To prevent the maximum size assignment, the maximum value is set to the maximum value of the int range.
Comment From: snicoll
I agree with @bclozel this change is likely to make the performance worse.
Going forward, before submitting a change like this, please look for actual usages and share a benchmark that demonstrates the proposal improves the status quo.