r/programming • u/Eirenarch • Nov 18 '13
TIL Oracle changed the internal String representation in Java 7 Update 6 increasing the running time of the substring method from constant to N
http://java-performance.info/changes-to-string-java-1-7-0_06/
1.4k
Upvotes
View all comments
Show parent comment
3
u/ryosen Nov 18 '13
You are relying on predictable performance, however. This change means that code that previously ran quickly will suddenly and inexplicably start running slower. If you're using substring in a loop (as you would with, say, a parser routine), this could be a very difficult performance degradation to troubleshoot. At the absolute very least, a change like this to a very commonly used method of a core object should be announced and publicized by Oracle.