RednaxelaFX对《Java Performance》的笔记(1)

RednaxelaFX
RednaxelaFX (Script Ahead, Code Behind)

在读 Java Performance

Java Performance
  • 书名: Java Performance
  • 作者: Scott Oaks
  • 副标题: The Definitive Guide
  • 页数: 426
  • 出版社: O'Reilly Media
  • 出版年: 2014-5-1
  • 第77页 Basic Tunings: Client or Server (or Both)
    Compiler Flags Are Different Unlike most Java flags, the flags to select a compiler are different: most of them do not use -XX. The standard compiler flags are simple words: -client, -server, or -d64. The exception here is tiered compilation, which is enabled with a flag in the common format: -XX:+TieredCompilation. Tiered compilation implies that the server compiler must be used. The following command silently turns off tiered compilation, because it conflicts with the choice of the client compiler: % java -client -XX:+TieredCompilation other_args
    引自 Basic Tunings: Client or Server (or Both)

    这段基本正确,不过有个坑(书里后面第83页Table 4-4也有提到),那就是在64位平台上没有HotSpot Client VM,只有HotSpot Server VM。所以java -client在64位平台上会被忽略,实际启用的仍然是HotSpot Server VM而不是指定的Client VM。而且这是隐式的,没有任何警告。 例如在Linux/x86-64上运行下面例子: $ java -client -XX:+TieredCompilation -XX:+PrintFlagsFinal -version | grep TieredCompilation bool TieredCompilation := true {pd product} java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) 我们还是会看到启用了多层编译的HotSpot Server VM…

    2014-05-20 09:35:52 回应