On Thu, Apr 11, 2013 at 12:55 PM, Ulf Zibis <ulf.zi...@cosoco.de> wrote:
> > Anyway as those methods all need some CPU time to execute normally, I'm > not sure if it's worth to save 1 comparison by outsourcing. > Saving one comparison is worth doing in any case in these performance-critical methods. "Out-lining" the creation of the detail message is a standard refactoring that is known to make hotspot happy. > Additionally having getCharsOutOfBounds as source for the exceptions > cause/stacktrace could lead to some confusion. > Let's use this sane exception detail: private String outOfBoundsMsg(int srcBegin, int srcEnd) { return "srcBegin = " + srcBegin + ", srcEnd = " + srcEnd + ", length() = " + count; }