Changeset 11d4fa5 for doc/theses


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.

Location:
doc/theses/andrew_beach_MMath/code
Files:
6 edited

Legend:

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

    racb38ce9 r11d4fa5  
    2020        }
    2121
     22        private static long loop(int times) {
     23                long startTime = System.nanoTime();
     24                for (int count = 0 ; count < times ; ++count) {
     25                        try {
     26                                cond_catch();
     27                        } catch (EmptyException exc) {
     28                                // ...
     29                        }
     30                }
     31                long endTime = System.nanoTime();
     32                return endTime - startTime;
     33        }
     34
    2235        public static void main(String[] args) {
    2336                int times = 1;
     
    2942                }
    3043
    31                 long startTime = System.nanoTime();
    32                 for (int count = 0 ; count < times ; ++count) {
    33                         try {
    34                                 cond_catch();
    35                         } catch (EmptyException exc) {
    36                                 // ...
    37                         }
    38                 }
    39                 long endTime = System.nanoTime();
    40                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     44                // Warm-Up:
     45                loop(1000);
     46
     47                long time = loop(times);
     48                System.out.println("Run-Time (ns): " + time);
    4149        }
    4250}
  • 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}
  • 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}
  • doc/theses/andrew_beach_MMath/code/ThrowEmpty.java

    racb38ce9 r11d4fa5  
    1212        }
    1313
     14        private static long loop(int times, int total_frames) {
     15                long startTime = System.nanoTime();
     16                for (int count = 0 ; count < times ; ++count) {
     17                        try {
     18                                unwind_empty(total_frames);
     19                        } catch (EmptyException e) {
     20                                // ...
     21                        }
     22                }
     23                long endTime = System.nanoTime();
     24                return endTime - startTime;
     25        }
     26
    1427        public static void main(String[] args) {
    1528                int times = 1;
     
    2235                }
    2336
    24                 long startTime = System.nanoTime();
    25                 for (int count = 0 ; count < times ; ++count) {
    26                         try {
    27                                 unwind_empty(total_frames);
    28                         } catch (EmptyException e) {
    29                                 // ...
    30                         }
    31                 }
    32                 long endTime = System.nanoTime();
    33                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     37                // Warm-Up:
     38                loop(1000, total_frames);
     39
     40                long time = loop(times, total_frames);
     41                System.out.println("Run-Time (ns): " + time);
    3442        }
    3543}
  • doc/theses/andrew_beach_MMath/code/ThrowFinally.java

    racb38ce9 r11d4fa5  
    1313        }
    1414
     15        private static long loop(int times, int total_frames) {
     16                long startTime = System.nanoTime();
     17                for (int count = 0 ; count < times ; ++count) {
     18                        try {
     19                                unwind_finally(total_frames);
     20                        } catch (EmptyException e) {
     21                                // ...
     22                        }
     23                }
     24                long endTime = System.nanoTime();
     25                return endTime - startTime;
     26        }
     27
    1528        public static void main(String[] args) {
    1629                int times = 1;
     
    2336                }
    2437
    25                 long startTime = System.nanoTime();
    26                 for (int count = 0 ; count < times ; ++count) {
    27                         try {
    28                                 unwind_finally(total_frames);
    29                         } catch (EmptyException e) {
    30                                 // ...
    31                         }
    32                 }
    33                 long endTime = System.nanoTime();
    34                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     38                // Warm-Up:
     39                loop(1000, total_frames);
     40
     41                long time = loop(times, total_frames);
     42                System.out.println("Run-Time (ns): " + time);
    3543        }
    3644}
  • doc/theses/andrew_beach_MMath/code/ThrowOther.java

    racb38ce9 r11d4fa5  
    2424        }
    2525
    26         public static void main(String[] args) {
    27                 int times = 1;
    28                 int total_frames = 1;
    29                 if (0 < args.length) {
    30                         times = Integer.parseInt(args[0]);
    31                 }
    32                 if (1 < args.length) {
    33                         total_frames = Integer.parseInt(args[1]);
    34                 }
    35 
     26        private static long loop(int times, int total_frames) {
    3627                long startTime = System.nanoTime();
    3728                for (int count = 0 ; count < times ; ++count) {
     
    4536                }
    4637                long endTime = System.nanoTime();
    47                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     38                return endTime - startTime;
     39        }
     40
     41        public static void main(String[] args) {
     42                int times = 1;
     43                int total_frames = 1;
     44                if (0 < args.length) {
     45                        times = Integer.parseInt(args[0]);
     46                }
     47                if (1 < args.length) {
     48                        total_frames = Integer.parseInt(args[1]);
     49                }
     50
     51                // Warm-Up:
     52                loop(1000, total_frames);
     53
     54                long time = loop(times, total_frames);
     55                System.out.println("Run-Time (ns): " + time);
    4856        }
    4957}
Note: See TracChangeset for help on using the changeset viewer.