← Back to team overview

ufl team mailing list archive

Alternative faster assertion method

 

I won't change the code everywhere to do this now,
but if profiling in the future shows all the ufl_assert
calls to take significant time, we can do this:

  isinstance(a, Expr) or error("Expecting Expr instance.")

instead of this:

  ufl_assert(isinstance(a, Expr), "Expecting Expr instance.")

They do exactly the same, the length is about the same,
but the former is much cheaper as long as it doesn't trigger.

Martin


Follow ups