Closed greedy closed 2 years ago
Update to use Exn.raise_without_backtrace and made the same improvement in a few more places
Thanks for the patch. We actually happened to make the same improvement internally but it hadn't been pushed to GitHub yet. I'll leave this issue open until the push happens.
The add function uses the
Same
exception to exit early and return the input set unchanged. The exception was being raised with plainraise
which causes expensive stack walking to build a backtrace. Raising the exception withraise_notrace
produces a nice performance improvement in programs where this function is not and without changing program semantics since the exception cannot escape theadd
function.