Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential performance improvements #167

Open
kemsky opened this issue Jul 11, 2021 · 1 comment
Open

Potential performance improvements #167

kemsky opened this issue Jul 11, 2021 · 1 comment

Comments

@kemsky
Copy link

kemsky commented Jul 11, 2021

Enhanced classes still do call parent default constructor e.g.:

image

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);
        }
@Ararem
Copy link

Ararem commented Oct 27, 2021

I also wonder if the same could be done for EnhancedStackFrame:
image
I'm having a lot of performance penalties due to this :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants