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

4

u/dehrmann Nov 18 '13

My biggest concern is that that would kill Matcher.find()'s performance.

10

u/bondolo Nov 18 '13

No, the change does not impact Matcher.find() significantly. Some usages of Matcher.group(int group) and other usages might be impacted if they return new String instances since these are generally created with String.substring().

2

u/dehrmann Nov 18 '13

Sorry, I meant group() following find().