Ben.Demystifier
Ben.Demystifier copied to clipboard
Potential performance improvements
Enhanced classes still do call parent default constructor e.g.:
CaptureStackTrace
call is redundant, it comes from StackTrace()
constructor.
In this case, we could explicitly call StackTrace(StackFrame frame)
with some dummy value, to avoid an expensive call:
public EnhancedStackTrace(Exception e) : base((StackFrame) null)
{
if (e == null)
{
throw new ArgumentNullException(nameof(e));
}
_frames = GetFrames(e);
}
public EnhancedStackTrace(StackTrace stackTrace) : base((StackFrame) null)
{
if (stackTrace == null)
{
throw new ArgumentNullException(nameof(stackTrace));
}
_frames = GetFrames(stackTrace);
}
I also wonder if the same could be done for EnhancedStackFrame
:
I'm having a lot of performance penalties due to this :(