sentry-php icon indicating copy to clipboard operation
sentry-php copied to clipboard

Add fast path for ignoring errors

Open stayallive opened this issue 1 year ago • 0 comments

This change makes the ErrorHandler aware of the SDK options in default operations and allows it to take a fast path and ignore errors without doing any work instead of building up a error exception and discarding it in the ErrorListenerIntegration. If a lot of errors are being ignored this can end up saving a some time and wasted CPU cycles.

This should be completely backwards compatible and if anyone uses the ErrorHandler directly they should not see any improvement nor any negative effect nor need to change their code. But if the ErrorHandler is managed by the SDK it will become Options aware and allow to take the fast path.

There are intentionally no tests since this change only should affect performance and has no effect on the outcome or operation of the SDK. Either shouldHandleError or the two if cases in the ErrorHandler can be removed without any failing tests and having both also leaves all tests intact proving we still handle and ignore the same errors as before just with slightly improved performance now.

Fixes #1736.

stayallive avatar May 03 '24 20:05 stayallive