If you're a Java programmer, you want to be aware of this: String.substring() just went from O(1) to O(n)!
If you're a Java programmer, you want to be aware of this: String.substring() just went from O(1) to O(n)!
http://java-performance.info/changes-to-string-java-1-7-0_06/
http://java-performance.info/changes-to-string-java-1-7-0_06/
Writing your own String implementation is practically impossible, since String is a final class, so you'd have to rewrite everything that uses a string. Which is roughly everything.
ReplyDeleteIt's for security, you know.
Sure, your implementation will not mesh with any existing code, but there are cases where it is worth it. Sometimes, you also need a String implementation that can do concatenation in constant time. This shouldn't be default behavior, but some apps get a performance boost by it.
ReplyDeleteTrue, but then it's more like a rope or twine or cord or something, rather than a string.
ReplyDelete