We're updating the issue view to help you get more done. 

Integer.toString doesn't keep cache of common values

Description

Integer.toString(int num, int radix) may account for nearly 2% of a single iteration of DaCapo bloat's execution time. A cache of common string values for ints isn't maintained. Such a cache would successfully hit with the following percentages:

cache[-128 to 127] =48.8207816707269%
cache[-9 to 9] =30.4192149990097%
cache[0 to 9] =18.860925823555%

Each hit would avoid creating a 33byte char[] and then allocating a String to wrap it. The single digits cases could in fact use the digits char[] in java.lang.Number.

Environment

None

Status

Assignee

Ian Rogers

Reporter

Ian Rogers

Labels

None

External issue ID

None

Components

Fix versions

Priority

Low