source: doc/theses/andrew_beach_MMath/performance.tex @ b6749fd

enumforall-pointer-decayjacob/cs343-translationnew-ast-unique-expr
Last change on this file since b6749fd was b6749fd, checked in by Peter A. Buhr <pabuhr@…>, 11 months ago

proofread Andrew's implement, performance and future chapters

  • Property mode set to 100644
File size: 4.6 KB
Line 
1\chapter{Performance}
2\label{c:performance}
3
4\textbf{Just because of the stage of testing there are design notes for
5the tests as well as commentary on them.}
6
7Performance has been of secondary importance for most of this project.
8Instead, the goal has been to get the features working.
9The only performance
10requirements is to ensure the exception tests for correctness ran in a reasonable
11amount of time.
12Much of the implementation is still reasonable and could be used for similar prototypes.
13Hence,
14the work still has some use.
15To get a rough idea about the \CFA implementation, tests are run on \CFA, C++ and Java, which have similar termination-handling exceptions.
16Tests are also run on \CFA and uC++, which has similar resumption-handling exceptions.
17
18\section{Termination Comparison}
19C++ is the most comparable language because both it and \CFA use the same
20framework, libunwind.
21In fact, the comparison is almost entirely a quality of implementation
22comparison. \CFA's EHM has had significantly less time to be optimized and
23does not generate its own assembly. It does have a slight advantage in that
24there are some features it does not handle.
25
26The Java comparison is an opportunity to compare a managed memory model with unmanaged,
27to see if there are any effects related to the exception model.
28
29\subsection{Test Set-Up}
30All tests are run inside a main loop that performs the test
31repeatedly. This design avoids start-up or tear-down time from
32affecting the timing results.
33A consequence is that tests cannot terminate the program, which does limit
34how tests can be implemented. There are catch-alls to keep unhandled
35exceptions from terminating tests.
36
37The exceptions used in this test are always a new exception based off of
38the base exception. This requirement minimizes performance differences based
39on the object model.
40Catch-alls are done by catching the root exception type (not using \Cpp's
41\code{C++}{catch(...)}).
42
43Tests run in Java were not warmed because exception code paths should not be
44hot.
45
46\subsection{Tests}
47The following tests capture the most important aspects of exception handling and should provide
48a reasonable guide to programmers of where EHM costs occur.
49
50\paragraph{Raise/Handle}
51What is the basic cost to raise and handle an exception?
52
53There are a number of factors that can effect this.
54For \CFA this includes
55the type of raise,
56
57Main loop, pass through a catch-all, call through some empty helper functions
58to put frames on the stack then raise and exception.
59\todo{Raise/Handle (or a similar test) could also test how much it costs to
60search over things, not sure if that is a useful test.}
61
62\paragraph{Unwinding}
63Isolating the unwinding of the stack as much as possible.
64
65This has the same set-up as the raise/handle test except the intermediate
66stack frames contain either an object declaration with a destructor or a
67@try@ statement with no handlers except and a @finally@ clause.
68
69\paragraph{Enter/Leave}
70What is the cost of entering and leaving a try block, even if no exception
71is thrown?
72
73The test is a simple matter of entering
74and leaving a try statement.
75
76The only tunables here are which clauses are attached to the try block:
77termination handlers, resumption handlers and finally clauses.
78
79\paragraph{Re-throw and Conditional-Catch}
80How expensive it is to run a non-exception type check for a handler?
81
82In this case different languages approach this problem differently, either
83through a re-throw or a conditional-catch.
84Where \CFA uses its condition, other languages must unconditionally
85catch the exception then re-throw if the condition if the condition is false.
86
87The set up is as follows: main loop, a catch-all exception handler,
88a conditional catch and then the raise.
89
90% We could do a Cforall test without the catch all and a new default handler
91% that does a catch all.
92As a point of comparison, one of the raise/handle tests (which one?) has
93same layout but never catches anything.
94
95The main tunable in this test is how often the conditional-catch matches.
96
97%\section{Cost in Size}
98%Using exceptions also has a cost in the size of the executable.
99%Although it is sometimes ignored
100%
101%There is a size cost to defining a personality function but the later problem
102%is the LSDA which will be generated for every function.
103%
104%(I haven't actually figured out how to compare this, probably using something
105%related to -fexceptions.)
106
107
108\section{Resumption Comparison}
109% Some languages I left out:
110% Python: Its a scripting language, different
111% uC++: Not well known and should the same results as C++, except for
112%   resumption which should be the same.
113\todo{Can we find a good language to compare resumptions in.}
Note: See TracBrowser for help on using the repository browser.