Changes in / [f7f07f6:d5f6a14]
- Files:
-
- 24 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/performance.tex
rf7f07f6 rd5f6a14 4 4 \textbf{Just because of the stage of testing there are design notes for 5 5 the 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 6 9 7 Performance has been of secondary importance for most of this project. … … 12 10 amount of time. 13 11 14 %\section{Termination Comparison}15 12 \section{Test Set-Up} 16 13 Tests will be run on \CFA, C++ and Java. … … 51 48 The should provide a guide as to where the EHM's costs can be found. 52 49 53 \paragraph{Raise/Handle} 54 What is the basic cost to raise and handle an exception? 50 Tests are run in \CFA, \Cpp and Java. 51 Not every test is run in every language, if the feature under test is missing 52 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 same 55 except that the raise statements and handler clauses are replaced with the 56 resumption variants. 55 57 56 There are a number of factors that can effect this. 57 For \CFA this includes the type of raise, 58 \paragraph{Raise and Handle} 59 The first group of tests involve setting up 60 So there is three layers to the test. The first is set up and a loop, which 61 configures the test and then runs it repeatedly to reduce the impact of 62 start-up and shutdown on the results. 63 Each iteration of the main loop 64 \begin{itemize} 65 \item Empty Function: 66 The repeating function is empty except for the necessary control code. 67 \item Destructor: 68 The repeating function creates an object with a destructor before calling 69 itself. 70 (Java is skipped as it does not destructors.) 71 \item Finally: 72 The repeating function calls itself inside a try block with a finally clause 73 attached. 74 (\Cpp is skipped as it does not have finally clauses.) 75 \item Other Handler: 76 The repeating function calls itself inside a try block with a handler that 77 will not match the raised exception. (But is of the same kind of handler.) 78 \end{itemize} 58 79 59 Main loop, pass through a catch-all, call through some empty helper functions 60 to 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 62 search over things, not sure if that is a useful test.} 80 \paragraph{Cross Try Statement} 81 The next group measures the cost of a try statement when no exceptions are 82 raised. The test is set-up, then there is a loop to reduce the impact of 83 start-up and shutdown on the results. 84 In each iteration, a try statement is executed. Entering and leaving a loop 85 is all the test wants to do. 86 \begin{itemize} 87 \item Handler: 88 The try statement has a handler (of the matching kind). 89 \item Finally: 90 The try statement has a finally clause. 91 \end{itemize} 63 92 64 \paragraph{Unwinding} 65 Isolating the unwinding of the stack as much as possible. 66 67 This has the same set-up as the raise/handle test except the intermediate 68 stack frames contain either an object declaration with a destructor or a 69 try statement with no handlers except for a finally clause. 70 71 \paragraph{Enter/Leave} 72 What is the cost of entering and leaving a try block, even if no exception 73 is thrown? 74 75 This test is a simple pattern of entering 76 and leaving a try statement. 77 78 The only tunables here are which clauses are attached to the try block: 79 termination handlers, resumption handlers and finally clauses. 80 81 \paragraph{Re-throw and Conditional-Catch} 82 How expensive it is to run a non-exception type check for a handler? 83 84 In this case different languages approach this problem differently, either 85 through a re-throw or a conditional-catch. 86 Where \CFA uses its condition other languages will have to unconditionally 87 catch the exception then re-throw if the condition if the condition is false. 88 89 The set up is as follows: main loop, a catch-all exception handler, 90 a 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. 94 As a point of comparison one of the raise/handle tests (which one?) has 95 same layout but never catches anything. 96 97 The main tunable in this test is how often the conditional-catch matches. 93 \paragraph{Conditional Matching} 94 This group of tests checks the cost of conditional matching. 95 Only \CFA implements the language level conditional match, 96 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: 100 The condition is always true. (Always matches or never re-raises.) 101 \item Catch None: 102 The condition is always false. (Never matches or always re-raises.) 103 \end{itemize} 98 104 99 105 %\section{Cost in Size} -
src/AST/Node.cpp
rf7f07f6 rd5f6a14 47 47 const ast::ParseNode * parse = dynamic_cast<const ast::ParseNode *>( node ); 48 48 if ( nullptr == parse ) { 49 assertf( nullptr, "%s (no location)", toString(node).c_str());49 assertf(false, "%s (no location)", toString(node).c_str()); 50 50 } else if ( parse->location.isUnset() ) { 51 assertf( nullptr, "%s (unset location)", toString(node).c_str());51 assertf(false, "%s (unset location)", toString(node).c_str()); 52 52 } else { 53 assertf( nullptr, "%s (at %s:%d)", toString(node).c_str(),53 assertf(false, "%s (at %s:%d)", toString(node).c_str(), 54 54 parse->location.filename.c_str(), parse->location.first_line); 55 55 } -
src/GenPoly/GenPoly.cc
rf7f07f6 rd5f6a14 64 64 } 65 65 66 __attribute__((ununsed)) 66 67 bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TyVarMap & tyVars, const ast::TypeSubstitution * env) { 67 68 for (auto ¶m : params) { -
src/ResolvExpr/CandidateFinder.cpp
rf7f07f6 rd5f6a14 597 597 const ast::SymbolTable & symtab; 598 598 public: 599 static size_t traceId;599 // static size_t traceId; 600 600 CandidateFinder & selfFinder; 601 601 CandidateList & candidates; … … 890 890 } 891 891 } 892 892 893 893 // if argType is an unbound type parameter, all special functions need to be searched. 894 894 if (isUnboundType(argType)) { … … 1104 1104 // unification run for side-effects 1105 1105 unify( toType, cand->expr->result, cand->env, need, have, open, symtab ); 1106 Cost thisCost = 1106 Cost thisCost = 1107 1107 (castExpr->isGenerated == ast::GeneratedFlag::GeneratedCast) 1108 1108 ? conversionCost( cand->expr->result, toType, cand->expr->get_lvalue(), symtab, cand->env ) … … 1729 1729 found->second.ambiguous = true; 1730 1730 } 1731 } else { 1731 } else { 1732 1732 // xxx - can satisfyAssertions increase the cost? 1733 1733 PRINT( 1734 1734 std::cerr << "cost " << newCand->cost << " loses to " 1735 1735 << found->second.candidate->cost << std::endl; 1736 ) 1736 ) 1737 1737 } 1738 1738 } else { … … 1819 1819 if ( mode.failFast && pruned.empty() ) { 1820 1820 std::ostringstream stream; 1821 if (found) { 1821 if (found) { 1822 1822 CandidateList winners = findMinCost( candidates ); 1823 1823 stream << "Cannot choose between " << winners.size() << " alternatives for " -
src/ResolvExpr/Unify.cc
rf7f07f6 rd5f6a14 1044 1044 } 1045 1045 1046 return { new ast::TupleType{ std::move(out) }};1046 return new ast::TupleType{ std::move(out) }; 1047 1047 } 1048 1048 -
src/SymTab/Validate.cc
rf7f07f6 rd5f6a14 1628 1628 } 1629 1629 }; 1630 */1631 1630 1632 1631 /// expand assertions from a trait instance, performing appropriate type variable substitutions … … 1646 1645 } 1647 1646 } 1648 1649 /*1650 1647 1651 1648 /// Associates forward declarations of aggregates with their definitions -
src/SynTree/AggregateDecl.cc
rf7f07f6 rd5f6a14 92 92 std::list< Expression * > copy_parameters; 93 93 cloneAll( new_parameters, copy_parameters ); 94 return makeInst( move( copy( copy_parameters )) );94 return makeInst( copy( copy_parameters ) ); 95 95 } 96 96 -
src/SynTree/ReferenceToType.cc
rf7f07f6 rd5f6a14 207 207 Type::print( os, indent ); 208 208 os << "instance of " << typeString() << " "; 209 const auto & name_ = get_name();210 209 if( deterministic_output && isUnboundType(name) ) os << "[unbound]"; 211 210 else os << name;
Note: See TracChangeset
for help on using the changeset viewer.