In ex-info, add ability to set options for suppression and writable stacktrace
Description
There's new Throwable constructor in Java 7 which allows to set options for enabling/disabling suppression and writable stacktrace. The latter is most interesting due to performance reasons: creating Throwable without stacktrace is ~70x faster. Proposed improvement adds ability for ExceptionInfo to accept this options.
Environment
None
Attachments
1
2423.patch
05 Nov, 2018
Activity
Alex Miller
November 5, 2018 at 8:11 PM
We use ExceptionInfo stacks all the time so I don't buy that, and I think the case where optimization would affect anything is rare. I'm going to decline this - I don't think it's worth complicating the api for this.
alex
November 5, 2018 at 2:52 PM
I use ExceptionInfo as a "fail" container in https://github.com/dawcs/flow, but I worry a bit about performance, cause creating ExceptionInfo is costly(due to filling stacktrace). In most cases where it's used now, we don't need stacktrace for ExceptionInfo, so I thought it may be good case for optimization.
Alex Miller
November 5, 2018 at 2:44 PM
Why do we care how fast it is to create a Throwable?
There's new Throwable constructor in Java 7 which allows to set options for enabling/disabling suppression and writable stacktrace. The latter is most interesting due to performance reasons: creating Throwable without stacktrace is ~70x faster. Proposed improvement adds ability for ExceptionInfo to accept this options.