Changeset 9698690
- Timestamp:
- Jul 21, 2021, 2:55:01 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 209dfe2
- Parents:
- 2ead704
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/performance.tex
r2ead704 r9698690 1 1 \chapter{Performance} 2 2 \label{c:performance} 3 4 \textbf{Just because of the stage of testing there are design notes for5 the tests as well as commentary on them.}6 3 7 4 Performance has been of secondary importance for most of this project. … … 11 8 12 9 \section{Test Set-Up} 13 Tests will be run on \CFA, C++ and Java. 10 Tests will be run in \CFA, C++, Java and Python. 11 In addition there are two sets of tests for \CFA, 12 one for termination exceptions and once with resumption exceptions. 14 13 15 14 C++ is the most comparable language because both it and \CFA use the same … … 18 17 comparison. \CFA's EHM has had significantly less time to be optimized and 19 18 does not generate its own assembly. It does have a slight advantage in that 20 there are some features it does not handle. 19 there are some features it does not handle, through utility functions, 20 but otherwise \Cpp has a significant advantage. 21 21 22 22 Java is another very popular language with similar termination semantics. … … 25 25 It also implements the finally clause on try blocks allowing for a direct 26 26 feature-to-feature comparison. 27 As with \Cpp, Java's implementation is more mature, has more optimizations 28 and more extra features. 29 30 Python was used as a point of comparison because of the \CFA EHM's 31 current performance goals, which is not be prohibitively slow while the 32 features are designed and examined. Python has similar performance goals for 33 creating quick scripts and its wide use suggests it has achieved those goals. 34 35 Unfortunately there are no notable modern programming languages with 36 resumption exceptions. Even the older programming languages with resumptions 37 seem to be notable only for having resumptions. 38 So instead resumptions are compared to a less similar but much more familiar 39 feature, termination exceptions. 27 40 28 41 All tests are run inside a main loop which will perform the test 29 42 repeatedly. This is to avoids start-up or tear-down time from 30 43 affecting the timing results. 31 A consequence of this is that tests cannot terminate the program, 32 which does limit how tests can be implemented. 33 There are catch-alls to keep unhandled 34 exceptions from terminating tests. 44 Most test were run 1 000 000 (a million) times. 45 The Java versions of the test also run this loop an extra 1000 times before 46 beginning to time the results to ``warm-up" the JVM. 47 48 Timing is done internally, with time measured immediately before and 49 immediately after the test loop. The difference is calculated and printed. 50 51 The loop structure and internal timing means it is impossible to test 52 unhandled exceptions in \Cpp and Java as that would cause the process to 53 terminate. 54 Luckily, performance on the ``give-up and kill the process" path is not 55 critical. 35 56 36 57 The exceptions used in these tests will always be a exception based off of 37 58 the base exception. This requirement minimizes performance differences based 38 on the object model. 39 Catch-alls are done by catching the root exception type (not using \Cpp's 40 \code{C++}{catch(...)}). 59 on the object model used to repersent the exception. 41 60 42 Tests run in Java were not warmed because exception code paths should not be 43 hot. 61 All tests were designed to be as minimal as possible while still preventing 62 exessive optimizations. 63 For example, empty inline assembly blocks are used in \CFA and \Cpp to 64 prevent excessive optimizations while adding no actual work. 65 66 % We don't use catch-alls but if we did: 67 % Catch-alls are done by catching the root exception type (not using \Cpp's 68 % \code{C++}{catch(...)}). 44 69 45 70 \section{Tests} … … 47 72 components of the exception system. 48 73 The should provide a guide as to where the EHM's costs can be found. 49 50 Tests are run in \CFA, \Cpp and Java.51 Not every test is run in every language, if the feature under test is missing52 the test is skipped. These cases will be noted.53 In addition to the termination tests for every language,54 \CFA has a second set of tests that test resumption. These are the same55 except that the raise statements and handler clauses are replaced with the56 resumption variants.57 74 58 75 \paragraph{Raise and Handle} … … 62 79 start-up and shutdown on the results. 63 80 Each iteration of the main loop 64 \begin{itemize} 81 \begin{itemize}[nosep] 65 82 \item Empty Function: 66 83 The repeating function is empty except for the necessary control code. … … 68 85 The repeating function creates an object with a destructor before calling 69 86 itself. 70 (Java is skipped as it does not destructors.)71 87 \item Finally: 72 88 The repeating function calls itself inside a try block with a finally clause 73 89 attached. 74 (\Cpp is skipped as it does not have finally clauses.)75 90 \item Other Handler: 76 91 The repeating function calls itself inside a try block with a handler that … … 84 99 In each iteration, a try statement is executed. Entering and leaving a loop 85 100 is all the test wants to do. 86 \begin{itemize} 101 \begin{itemize}[nosep] 87 102 \item Handler: 88 103 The try statement has a handler (of the matching kind). … … 95 110 Only \CFA implements the language level conditional match, 96 111 the other languages must mimic with an ``unconditional" match (it still 97 checks the exception's type) and conditional re-raise. 98 \begin{itemize} 99 \item Catch All: 112 checks the exception's type) and conditional re-raise if it was not supposed 113 to handle that exception. 114 \begin{itemize}[nosep] 115 \item Match All: 100 116 The condition is always true. (Always matches or never re-raises.) 101 \item Catch None:117 \item Match None: 102 118 The condition is always false. (Never matches or always re-raises.) 103 119 \end{itemize} … … 113 129 %related to -fexceptions.) 114 130 115 % Some languages I left out: 116 % Python: Its a scripting language, different 117 % uC++: Not well known and should the same results as C++, except for 118 % resumption which should be the same. 131 \section{Results} 132 Each test is was run five times, the best and worst result were discarded and 133 the remaining values were averaged. 119 134 120 %\section{Resumption Comparison} 121 \todo{Can we find a good language to compare resumptions in.} 135 In cases where a feature is not supported by a language the test is skipped 136 for that language. Similarly, if a test is does not change between resumption 137 and termination in \CFA, then only one test is written and the result 138 was put into the termination column. 139 140 \begin{tabular}{|l|c c c c c|} 141 \hline 142 & \CFA (Terminate) & \CFA (Resume) & \Cpp & Java & Python \\ 143 \hline 144 Raise Empty & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 145 Raise D'tor & 0.0 & 0.0 & 0.0 & N/A & N/A \\ 146 Raise Finally & 0.0 & 0.0 & N/A & 0.0 & 0.0 \\ 147 Raise Other & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 148 Cross Handler & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 149 Cross Finally & 0.0 & N/A & N/A & 0.0 & 0.0 \\ 150 Match All & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 151 Match None & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 152 \hline 153 \end{tabular}
Note: See TracChangeset
for help on using the changeset viewer.