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/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}
Note: See TracChangeset for help on using the changeset viewer.