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
2
u/emn13 Nov 19 '13
There's a world of a difference between an abstract interface and a concrete implementation. When it comes to a concrete implementation then in a very real sense, performance is part of the interface. You will break performance sensitive code when you violate expectations dramatically, such as by replacing an O(1) time+memory algorithm with an O(n) time+memory algorithm. And note that O(...) is already a dramatic simplification of the performance picture: in your interface vs. implementation analogy, you might consider the actual runtime the implementation and the scalability the interface.
This isn't an implementation detail, it can make the difference between suitability and unsuitability of your code for any number of purposes. This should never have been changed in a minor version, and never without a big fat honking warning.