source: doc/theses/andrew_beach_MMath/performance.tex @ 029cbc0

enumforall-pointer-decayjacob/cs343-translationnew-ast-unique-expr
Last change on this file since 029cbc0 was 029cbc0, checked in by Andrew Beach <ajbeach@…>, 13 months ago

Andrew MMath: Performance feedback is a bit stranger as the content is still unknown. (5/6 files done.)

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