Up to jdk7u6 the substring method was lightning fast because it simply used pointers within an existing string - thus required no memory copying. I used that feature extensively in implementing parsers.
Given the length of time since that critical performance feature was removed there must be some well oiled replacement.
Note: I could theoretically go back and copy the implementation from jdk6. But IIRC it was wrapped up pretty heavily in the entire String class - i.e. not easily extracted.
So is such an implementation lying around - e.g in one of the high performance jvm parser libraries?
You might be able to do what you need with CharBuffer, which implements the CharSequence
interface. See, in particular, CharBuffer.subSequence
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With