Ignore:
Timestamp:
Jul 7, 2021, 11:56:29 AM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
47e413b
Parents:
acb38ce9
Message:

Updated the Java exception benchmarks to provide some warm-up. Does not appear to change results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/CrossCatch.java

    racb38ce9 r11d4fa5  
    44
    55public class CrossCatch {
    6         public static void main(String[] args) {
    7                 int times = 1;
    8                 boolean shouldThrow = false;
    9                 if (0 < args.length) {
    10                         times = Integer.parseInt(args[0]);
    11                 }
     6        private static boolean shouldThrow = false;
    127
     8        private static long loop(int times) {
    139                long startTime = System.nanoTime();
    1410                for (int count = 0 ; count < times ; ++count) {
     
    2218                }
    2319                long endTime = System.nanoTime();
    24                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     20                return endTime - startTime;
     21        }
     22
     23        public static void main(String[] args) {
     24                int times = 1;
     25                if (0 < args.length) {
     26                        times = Integer.parseInt(args[0]);
     27                }
     28
     29                // Warm-Up:
     30                loop(1000);
     31
     32                long time = loop(times);
     33                System.out.println("Run-Time (ns): " + time);
    2534        }
    2635}
Note: See TracChangeset for help on using the changeset viewer.