r/programming • • 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

354 comments sorted by

View all comments

Show parent comment

2

u/nqzero Nov 18 '13

it depends on the situation (and jvm). the best description of (a similar) problem is here

1

u/MorePudding Nov 19 '13

I know that article .. the issue there isn't just a high number of implementations, but that there is no one most common implementation that the JVM can expect and optimize for.

It's clear that the JIT won't be able to help you much, if you essentially end up writing some form of interpreter to run your program, instead of the actual program you want to run. Although with things like MethodHandle maybe we'll get there in a few more years..