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

Invokes trace action for actions that are not traced #5

Open
breyed opened this issue Oct 15, 2015 · 3 comments
Open

Invokes trace action for actions that are not traced #5

breyed opened this issue Oct 15, 2015 · 3 comments

Comments

@breyed
Copy link

breyed commented Oct 15, 2015

ITraceWriter is designed to not incur a performance cost for categories and levels where tracing is disabled. Specifically, traceAction should only be called if tracing is enabled. Accordingly, NlogTraceWriter.Trace should first check whether NLog is tracing at a given level, and only call traceAction if it is. This would provide a major performance improvement.

@panesofglass
Copy link
Member

That's a great idea! Would you mind submitting a PR?

@breyed
Copy link
Author

breyed commented Oct 15, 2015

I wouldn't mind, but I'd rather not allocate the time to jump into this this project. It seems an easy fix. If not, I can help out.

On a separate perf topic, you could replace the lazy dictionary with a simple array and get a nice boost as well. In general, tracing libraries tend to be performance sensitive, so they are worthy of more optimization effort than other code.

@panesofglass
Copy link
Member

@breyed, thanks for logging the issue.

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

No branches or pull requests

2 participants