RFR: JDK-8032012, , String.toLowerCase/toUpperCase performance improvement

Ulf Zibis Ulf.Zibis at CoSoCo.de
Fri Feb 7 17:05:38 UTC 2014


Am 07.02.2014 15:27, schrieb Remi Forax:
> if the JIT is not able to fold
>   for(;i<len;) {
>      // may call break in the body
>   }
>   if (i == len) {
>     // ...
>   }
>
> given that it's a common pattern,
> i think it's better to improve the JIT that to change the code.
Then JIT must examine the complete for statement+block to prove that i will never become >len. I 
suspect such examination will be manageable.


Am 07.02.2014 15:58, schrieb Vitaly Davidovich:
> One issue here though is the overall method size and complexity (esp if some other methods are 
> inlined into it). 

To serve this, my favourite, even it may be less readable, is:
     find1stUpperCase: {
         for(;i<len;) {
             // may call "break find1stUpperCase;" in the body
         }
         // ...
     }

-Ulf





More information about the core-libs-dev mailing list