Why is the JVM slow to start?

后端 未结 8 1809
耶瑟儿~
耶瑟儿~ 2020-12-13 12:42

What exactly makes the JVM (in particular, Sun\'s implementation) slow to get running compared to other runtimes like CPython? My impression was that it mainly has to do wit

8条回答
  •  爱一瞬间的悲伤
    2020-12-13 13:28

    If you are using Sun's HotSpot for x86_64 (64bit compiled), note that the current implementation only works in server mode, that is, it precompiles every class it loads with full optimization, whereas the 32bit version also supports client mode, which generally postpones optimization and optimizes the most CPU-intensive parts only, but has faster start-up times.

    See for instance:

    • http://en.wikipedia.org/wiki/64-bit#32_vs_64_bit
    • http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_compilers

    That being said, at least on my machine (Linux x86_64 with 64bit kernel), the 32bit HotSpot version supports both client and server mode (via the -client and -server flags), but defaults to server mode, while the 64bit version only supports server mode.

提交回复
热议问题