perf(library/elaborator): avoid exception
Lean was spending 17% on the runtime "throwing exceptions" in the test tests/lean/implicit7.lean Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
1fb526a3d4
commit
5ae71e75bd
1 changed files with 5 additions and 0 deletions
|
@ -224,6 +224,11 @@ class elaborator::imp {
|
|||
|
||||
/** \brief Return true iff \c a is a proposition */
|
||||
bool is_proposition(expr const & a, context const & ctx) {
|
||||
if (is_metavar(a)) {
|
||||
// Avoid exception at m_type_inferer.
|
||||
// Throw is expensive in C++.
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return m_type_inferer.is_proposition(a, ctx);
|
||||
} catch (...) {
|
||||
|
|
Loading…
Reference in a new issue