Monday, May 16, 2011

Non Multithreaded Vanilla Compiler Optimization Times

To help create a starting point for my work I started with profiling the execution times of each optimization in[1]

Optimizations (in
  1. // Compute defList, useList, useCount fields for each register.
  2.    // Recompute isSSA flags
  3. / Simple copy propagation.
        // This pass incrementally updates the register list.
  4.  // Simple type propagation.
        // This pass uses the register list, but doesn't modify it.
       if (typeProp) {
  5. // Perform simple bounds-check and arraylength elimination.
        // This pass incrementally updates the register list
        if (foldChecks) {
  6. // Simple dead code elimination.
        // This pass incrementally updates the register list
  7. // constant folding
        // This pass usually doesn't modify the DU, but
        // if it does it will recompute it.
        // Simple local expression folding respecting DU
        if (ir.options.LOCAL_EXPRESSION_FOLDING && ExpressionFolding.performLocal(ir)) {
          // constant folding again
  8. // Try to remove conditional branches with constant operands
        // If it actually constant folds a branch,
        // this pass will recompute the DU
        if (foldBranches) {
  9. // Should we sort commutative use operands
        if (sortRegisters) {

Next We add Timer Code, Make a Method Size API call, Make A Method Name API Call

startTime = System.nanoTime(); 
EndTime = System.nanoTime();

Method Name and Method Size:
final int methodinstructionSize = ir.numberInstructions();

 try{ //Debug Execution Time output
        // Create file
        FileWriter fstream = new FileWriter("computeDUmethodExecutionTime.txt",true);
            BufferedWriter out = new BufferedWriter(fstream);
        out.write("\nExecution Time: " + (EndTime - startTime) + " nano Seconds" + " Instructs: " + methodinstructionSize +  " Method: " + ir.getMethod().getName().toString());
        //Close the output stream
        }catch (Exception e){//Catch exception if any
          System.err.println("Error: " + e.getMessage());

./rvm -classpath dacapo-2006-10-MR2.jar Harness fop

We are left with ASCII files for each individual optimization containing data on Method Size, Method Execution Time, and Name

Execution Time: 21200 nano Seconds Instructs: 37 Method: stringToGlyph
Execution Time: 13520 nano Seconds Instructs: 53 Method: scanDigits
Execution Time: 17480 nano Seconds Instructs: 72 Method: getExplicit
Execution Time: 108801 nano Seconds Instructs: 508 Method: getShorthand

Graphs (Size vs Time)

Array Propagation






No comments:

Post a Comment