source: doc/theses/andrew_beach_MMath/performance.tex @ 2f19e03

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 2f19e03 was b6749fd, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

proofread Andrew's implement, performance and future chapters

  • Property mode set to 100644
File size: 4.6 KB
RevLine 
[dac16a0]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.
[b6749fd]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
[dac16a0]11amount of time.
[b6749fd]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.
[dac16a0]17
[b6749fd]18\section{Termination Comparison}
[dac16a0]19C++ is the most comparable language because both it and \CFA use the same
20framework, libunwind.
[b6749fd]21In fact, the comparison is almost entirely a quality of implementation
[dac16a0]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
[b6749fd]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.
[dac16a0]28
[b6749fd]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
[dac16a0]32affecting the timing results.
[b6749fd]33A consequence is that tests cannot terminate the program, which does limit
[dac16a0]34how tests can be implemented. There are catch-alls to keep unhandled
[b6749fd]35exceptions from terminating tests.
[dac16a0]36
[b6749fd]37The exceptions used in this test are always a new exception based off of
38the base exception. This requirement minimizes performance differences based
[dac16a0]39on the object model.
[b6749fd]40Catch-alls are done by catching the root exception type (not using \Cpp's
[dac16a0]41\code{C++}{catch(...)}).
42
43Tests run in Java were not warmed because exception code paths should not be
44hot.
45
[b6749fd]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
[dac16a0]50\paragraph{Raise/Handle}
51What is the basic cost to raise and handle an exception?
52
[b6749fd]53There are a number of factors that can effect this.
54For \CFA this includes
[dac16a0]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
[b6749fd]67@try@ statement with no handlers except and a @finally@ clause.
[dac16a0]68
69\paragraph{Enter/Leave}
70What is the cost of entering and leaving a try block, even if no exception
71is thrown?
72
[b6749fd]73The test is a simple matter of entering
[dac16a0]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}
[b6749fd]80How expensive it is to run a non-exception type check for a handler?
[dac16a0]81
82In this case different languages approach this problem differently, either
83through a re-throw or a conditional-catch.
[b6749fd]84Where \CFA uses its condition, other languages must unconditionally
[dac16a0]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.
[b6749fd]92As a point of comparison, one of the raise/handle tests (which one?) has
[dac16a0]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.)
[b6749fd]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.