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

Optimize LoggingStream. #142

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

adamradocz
Copy link
Contributor

@adamradocz adamradocz commented Feb 11, 2022

Optimization of the LoggingStream.

  • Add StringBuilder Pool.
  • Add in keyword.
  • Use char instead of a string when appending to the StringBuilder.

Clean and conflict free version of #134

@@ -24,26 +27,36 @@ public static async Task Main(string[] args)

services.AddSignalR();

services.TryAddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like an unnecessary dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean using the String builder pool?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LoggingStream creates two new StringBuilders for every message that it logs. Why wouldn't you optimized that?

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

Successfully merging this pull request may close these issues.

2 participants