Am 21.05.2008 19:33, Xueming Shen schrieb:
It is a surprise to see that the String.charAt is way faster than the char[] index access...I had the assumption that the array access is faster when considering to move the mappable table from the String storage to a simple 256 length char[] for both singlebyte and doublebyte charsets.

Yes, it's surprising. I assume that there are some native machine code bypasses in the VM for String processing, whereas char[] index access is treated by the standard hotspot optimisation. I'm also wondering how array initialization is compiled to byte code. Compile
   char[] chars = {'\u0000', '\u0001', '\u0002', ..., '\u00FF' };
... and compare it with
   String charString = "\u0000+\u0001+\u0002+ ...+\u00FF";
by help of javap.

Ulf, Martin and I were (will continue to, hopely) working on a project to improve the performance of the charset implementation, your contribution will definitely appreciated.

Thanks very much. Where can I find your project?

-Ulf


Reply via email to