Open kemsky opened 3 years ago
Enhanced classes still do call parent default constructor e.g.:
CaptureStackTrace call is redundant, it comes from StackTrace() constructor.
CaptureStackTrace
StackTrace()
In this case, we could explicitly call StackTrace(StackFrame frame) with some dummy value, to avoid an expensive call:
StackTrace(StackFrame frame)
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 :(
EnhancedStackFrame
Enhanced classes still do call parent default constructor e.g.:
CaptureStackTrace
call is redundant, it comes fromStackTrace()
constructor.In this case, we could explicitly call
StackTrace(StackFrame frame)
with some dummy value, to avoid an expensive call: