On Mon, Mar 18, 2013 at 11:10 PM, Masayoshi Okutsu < masayoshi.oku...@oracle.com> wrote:
> On 3/19/2013 3:04 PM, Martin Buchholz wrote: > > > On Mon, Mar 18, 2013 at 7:44 PM, Masayoshi Okutsu < > masayoshi.oku...@oracle.com> wrote: > >> As for duplicating code, I originally duplicated similar code everywhere >> for performance. But someone told me probably during code review that >> hotspot inlining was as good as C/C++ macros, and I agreed to replace the >> duplicated code with method calls. >> >> > For classes as important as important as StringBuilder, I think we > should go the extra mile to ensure best performance, > > > That was exactly the reason why I initially took the same approach. So, > I'd like to leave the decision to performance experts. > > It suddenly occurred to me that we could use the Impl versions of the methods, because we are actually in the java.lang package. - return Character.codePointAt(value, index); + return Character.codePointAtImpl(value, index, count); - return Character.codePointBefore(value, index); + return Character.codePointBeforeImpl(value, index, 0); which removes the code duplication, and seems slightly faster in my hacky benchmarks. I'm pretty happy with this revision of the change. Can I have some ThumbsUps, please? > Masayoshi >