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

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since bd50205 was dac16a0, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Andrew MMath: Added the beginnings of performance chapter.

  • Property mode set to 100644
File size: 4.1 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.
8The driving for has been to get the features working, the only performance
9requirements were to make sure the tests for correctness rain in a reasonable
10amount of time.
11Still this is an implementation others could use for similar prototypes and
12so the results still have some use.
13
14\section{Test Set-Up}
15Tests will be run on \CFA, C++ and Java.
16
17C++ is the most comparable language because both it and \CFA use the same
18framework, libunwind.
19In fact the comparison is almost entirely a quality of implementation
20comparison. \CFA's EHM has had significantly less time to be optimized and
21does not generate its own assembly. It does have a slight advantage in that
22there are some features it does not handle.
23
24% Some languages I left out:
25% Python: Its a scripting language, different
26% uC++: Not well known and should the same results as C++, except for
27%   resumption which should be the same.
28\todo{Can we find a good language to compare resumptions in.}
29
30All tests will be run inside a main loop which will perform the test
31repeatedly. This is to avoid letting and start-up or tear-down time from
32affecting the timing results.
33This also means that tests cannot terminate the program, which does limit
34how tests can be implemented. There are catch-alls to keep unhandled
35exceptions from terminating the program.
36
37The exceptions used in this test will always be a new exception based off of
38the base exception. This should minimize and preformance differences based
39on the object model.
40Catch-alls will be 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\section{Tests}
47\paragraph{Raise/Handle}
48What is the basic cost to raise and handle an exception?
49
50There are a number of factors that can effect this, for \CFA this includes
51the type of raise,
52
53Main loop, pass through a catch-all, call through some empty helper functions
54to put frames on the stack then raise and exception.
55\todo{Raise/Handle (or a similar test) could also test how much it costs to
56search over things, not sure if that is a useful test.}
57
58\paragraph{Unwinding}
59Isolating the unwinding of the stack as much as possible.
60
61This has the same set-up as the raise/handle test except the intermediate
62stack frames contain either an object declaration with a destructor or a
63try statement with no handlers except for a finally clause.
64
65\paragraph{Enter/Leave}
66What is the cost of entering and leaving a try block, even if no exception
67is thrown?
68
69This is the simplist pattern to test as it is a simple matter of entering
70and leaving a try statement.
71
72The only tunables here are which clauses are attached to the try block:
73termination handlers, resumption handlers and finally clauses.
74
75\paragraph{Re-throw and Conditional-Catch}
76How expencive it is to run a non-exception type check for a handler?
77
78In this case different languages approach this problem differently, either
79through a re-throw or a conditional-catch.
80Where \CFA uses its condition other languages will have to unconditionally
81catch the exception then re-throw if the condition if the condition is false.
82
83The set up is as follows: main loop, a catch-all exception handler,
84a conditional catch and then the raise.
85
86% We could do a Cforall test without the catch all and a new default handler
87% that does a catch all.
88As a point of comparison one of the raise/handle tests (which one?) has
89same layout but never catches anything.
90
91The main tunable in this test is how often the conditional-catch matches.
92
93%\section{Cost in Size}
94%Using exceptions also has a cost in the size of the executable.
95%Although it is sometimes ignored
96%
97%There is a size cost to defining a personality function but the later problem
98%is the LSDA which will be generated for every function.
99%
100%(I haven't actually figured out how to compare this, probably using something
101%related to -fexceptions.)
Note: See TracBrowser for help on using the repository browser.