# Is there any speed improvement from wrapping invokelatest in a try-catch?

**URL:** https://discourse.julialang.org/t/is-there-any-speed-improvement-from-wrapping-invokelatest-in-a-try-catch/7958
**Category:** General Usage
**Tags:** question
**Created:** [December 24, 2017, 1:35am UTC](https://discourse.julialang.org/t/is-there-any-speed-improvement-from-wrapping-invokelatest-in-a-try-catch/7958 "2017-12-24T01:35:01Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [December 24, 2017, 9:51am UTC](https://discourse.julialang.org/t/is-there-any-speed-improvement-from-wrapping-invokelatest-in-a-try-catch/7958/3 "2017-12-24T09:51:02Z")

</div>

There was a [recent discussion](https://discourse.julialang.org/t/type-stable-matrix-factorization-corner-case-with-forwarddiff/7791) where I found `try ... catch` to be a reasonable solution if the exception is thrown only occasionally. `try` is not very costly, `catch` is. @Elrod kindly provided a lot of useful benchmarks there.

---

_[View the full topic](https://discourse.julialang.org/t/is-there-any-speed-improvement-from-wrapping-invokelatest-in-a-try-catch/7958)._
