Given that strings are immutable in .NET, I\'m wondering why they have been designed such that string.Substring() takes O(substring.Length) time, i
Java used to reference larger strings, but:
I feel like it can be improved though: why not just do the copying conditionally?
If the substring is at least half the size of the parent, one can reference the parent. Otherwise one can just make a copy. This avoids leaking a lot of memory while still providing a significant benefit.