News for hackers. Stuff that matters.
Re:Sentinels Can Be Faster by xfer on Wednesday September 09, 2020 @06:50PM (#24426816)
How huge typical strings are that this is a problem? It could be a problem for arrays but seems unlikely for strings.
Re:Sentinels Can Be Faster by Someone on Wednesday September 09, 2020 @10:47PM (#24428448)
Some strings start live as part of multi-megabyte text files that get slurped in. Happened quite a bit with HTML/XML parsers. Workaround was to do new String(s.substring(…)) about everywhere. Real world case (with few details) at https://stackoverflow.com/questions/10951812/java-not-garbag....

Also, using slices doesn’t come for free; it makes all String objects larger because, apart from the reference to the underlying character array, an offset and length must be kept around.