Duplicate :
|
|
Relates :
|
|
Relates :
|
The performance becomes too slow when isSupported runs for several charsets. The isSupported might not be used directly by java users. However, it is called when OutputStreamWriter or Reader is constructed. (which is, "new" operation applies to them) Those Stream classes is well-used and charset switch will well-occurs in 2 bytes locale environment. So, the performance deterioration is too big. REPRODUCE : (1) Compile the attached program (2) Launch "java isSupportedTest" ==> You will see the list in following "BEHAVIOR" . BEHAVIOR: The test program is lauching isSupported as follows. case1: to warm up compiled code and invoke isSupported "ISO-8859-1" case2: to warm up compiled code and invoke isSupported "UTF-8" case3: to invoke isSupported "ISO-8859-1" and "UTF-8" The performance in case3 is worse than the others. Please see below. Unit is mili second. ======= K:\nio-perf\isSupport>java isSupportedTest case1:60 case2:70 case3:6099 K:\nio-perf\isSupport>java -version java version "1.4.2_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02) Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode) ======= CONFIGURATION : OS : windowsXP (SP1, Japanese) JRE : 1.4.2_03 ================================================================================
|