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/CrossFinally.java

    racb38ce9 r11d4fa5  
    22
    33public class CrossFinally {
    4         public static void main(String[] args) {
    5                 int times = 1;
    6                 boolean shouldThrow = false;
    7                 if (0 < args.length) {
    8                         times = Integer.parseInt(args[0]);
    9                 }
     4        private static boolean shouldThrow = false;
    105
     6        private static long loop(int times) {
    117                long startTime = System.nanoTime();
    128                for (int count = 0 ; count < times ; ++count) {
     
    1814                }
    1915                long endTime = System.nanoTime();
    20                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     16                return endTime - startTime;
     17        }
     18
     19        public static void main(String[] args) {
     20                int times = 1;
     21                if (0 < args.length) {
     22                        times = Integer.parseInt(args[0]);
     23                }
     24
     25                // Warm-Up:
     26                loop(1000);
     27
     28                long time = loop(times);
     29                System.out.println("Run-Time (ns): " + time);
    2130        }
    2231}
Note: See TracChangeset for help on using the changeset viewer.