On 07.05.15 05:05, Neil Girdhar wrote:
Since strings are constant, wouldn't it be much faster to implement string slices as a view of other strings?
For clarity, I'm talking about CPython. I'm not talking about anything the user sees. The string views would still look like regular str instances to the user.
Note that String in Java was implemented as a view of underlying array of chars. This allowed sharing character data and fast (constant time) slicing. But the implementation was changed in Java 7u6.