32 bit vs 64 bit

- Differs per Operating System.
- 32bit
- The size of memory pointer is small. The size of memory which is supported by OS is small as well.
- Might be faster if heap is less than 3GB
- Only C1 compiler(=Client Compiler) is supported.
- Application like client application which ends right away after finishing its job is adequate for 32 bit
- The startup time is important for these applications
- The size of memory pointer is small. The size of memory which is supported by OS is small as well.
- 64bit
- Both Client Compiler(C1) and Server Compiler(C2) are supported.
- Application like server application which runs for a long time is adequate for 64 bit
- The startup time is less important for these applications
Mac doesn’t have 32 bit JVM. In this case, we can decide which compiler to use by providing a flag(-client). If we use client compiler(C1 compiler) only, the startup time can be improved.
- Some Operating system uses C2 compiler even though we provide the
-clientflag. However, using the-clientflag would improve the startup time anyways because it performs less analysis of the code.

JVM complier flags
-client: specifies to use only client compiler. This flag might be ignored from some operating systems.-server: selects 32 bit server compiler.-d64: selects 64 bit server compiler.-XX:-TieredCompilation: Ignore the tiered compilers and without the code cache, run the code only with the interpreters.
fyi – JVM decides when/which method to compile into native code cache by below factors.
- How many times the method has been called
- Whether loop exists inside the method
Tuning native compilation within the VM
There are 2 factors that usually affects the application compiling performance.
- How many threads available to run this compiling process
- For programs that require lot of compiling, the more threads we have, the faster compiling process it will be.
- What’s the threshold for native compilation
- The number of method invocation to get it compiled to native machine code.
Those two factors can be adjusted by providing flags.
- How many threads available to run this compiling process
- =>
-XX:CICompilerCountcan adjust the thread count for compiling - ex)
java -XX:CICompilerCount=6 -XX:+PrintCompilation <CLASS_NAME> <PARAMS>
- =>
- What’s the threshold for native compilation
- =>
-XX:CompileThreshold=n
- =>
Tips
Using -XX:PrintFlagsFinal , you can check how many compilers are being used for the process.

Also, you can check by using jinfo command, by retrieving the process id from jps.
jps: List of the java processes. Shows the process IDjinfo: Java info.- ex)
jinfo -flag CICompilerCount <PROCESS_ID>
- ex)

Leave a comment