Using a profile with the Builder

Having collected the profiling data, the Jamaica Compiler can now create a compiled version of the application using the profile information. This compiled version benefits from profiling information in several ways:

Building with a profile

The builder option -useProfile is used to select the generated profiling data:

  > jamaica -useProfile HelloWorld.prof HelloWorld
      
Reading configuration from '/usr/local/jamaica/target/linux-x86/...
Reading configuration from '/usr/local/jamaica/etc/jamaica.conf'...
Jamaica Builder Tool 3.4 Release 1
Generating code for target 'linux-x86', optimisation 'none'
 + PKG__V79d7fe8d0cc703dd__.c
 + PKG_java_io_Vcfc691ddc0775cdc__.c
 + PKG_java_lang_Vcfc691ddc0775cdc__.c
 + PKG_java_lang_ref_Vcfc691ddc0775cdc__.c
 + PKG_java_util_Vcfc691ddc0775cdc__.c
 + PKG_javax_realtime_Vcfc691ddc0775cdc__.c
 + HelloWorld__.c
 + HelloWorld__.h
Class file compaction gain: 75.304855% (14567448 ==> 3597452)
 * C compiling 'HelloWorld__.c'
 * C compiling 'PKG__V79d7fe8d0cc703dd__.c'
 * C compiling 'PKG_java_io_Vcfc691ddc0775cdc__.c'
 * C compiling 'PKG_java_lang_Vcfc691ddc0775cdc__.c'
 * C compiling 'PKG_java_lang_ref_Vcfc691ddc0775cdc__.c'
 * C compiling 'PKG_java_util_Vcfc691ddc0775cdc__.c'
 * C compiling 'PKG_javax_realtime_Vcfc691ddc0775cdc__.c'
 + HelloWorld__nc.o
 * linking
 * stripping
Application memory demand will be as follows:
                       initial               max
Thread C    stacks:     512KB (=   8*  64KB)   31MB (= 511*  64KB)
Thread Java stacks:     128KB (=   8*  16KB) 8176KB (= 511*  16KB)
Heap Size:             2048KB                 256MB
GC data:                128KB                  16MB
TOTAL:                 2816KB                 311MB
    
  

Due to the profile-guided optimizations performed by the compiler, the runtime performance of the application built using a profile as shown usually exceeds the performance of a fully compiled application. Furthermore, the memory footprint is significantly smaller and the modify-compile-run cycle time is usually significantly shorter as well since only a small fraction of the application needs to be compiled. It is not necessary to re-generate profile data after every modification.

Building with multiple profiles

You can use several profiles to improve the performance of your application. There are two possibilities to specify profiles that behave in a different way.

First you can just concatenate two profile files or dump a profile several times into the same file which will just behave as if the profiles were recorded sequentially. You can add a profile for a new feature this way.

If you want to favor a profile instead, e.g. a micro profile for startup or a performance critical section as described in the Section called Creating a micro profile, you can specify the profile with another -useProfile option. In this case, all profiles are normalized before they are concatenated, so highly rated methods in a short-run micro profile are more likely to be compiled.