8000 Speed up execution by offloading logging by danmoseley · Pull Request #75 · dotnet/api-docs-sync · GitHub
[go: up one dir, main page]

Skip to content

Speed up execution by offloading logging #75

New issue < 10000 /summary>

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

Merged
merged 9 commits into from
Aug 3, 2021

Conversation

danmoseley
Copy link
Member
@danmoseley danmoseley commented Aug 2, 2021

Move console writes to a separate thread.
On that thread, batch the calls to console.
Don't continue batching if the color changes.
Don't continue batching if it's been over a second. [Note, this isn't perfect; if another message doesn't come in for a while, it will wait. But it will never fail to write.]
Add logging to a file, since a large run will exhaust the console buffer.

With these changes, a small run was sped up from about 10-11 sec to 7 sec. When running over the whole tree, it can save minutes.

@stephentoub this is my first time using DataFlow blocks. Does it seem reasonable?

@stephentoub
Copy link
Member
stephentoub commented Aug 2, 2021

@stephentoub this is my first time using DataFlow blocks. Does it seem reasonable?

It's reasonable. But for this usage (just using a BufferBlock as a hand-off mechanism), it'd be better to use the newer channels library.

  • new BufferBlock => Channel.CreateUnbounded
  • OutputAvailableAsync => WaitToReadAsync
  • ReceiveAsync => ReadAsync
  • Post => TryWrite

danmoseley and others added 2 commits August 2, 2021 16:57
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
@jeffhandley
Copy link
Member

CI is failing on what looks like a missing using statement to get Task into scope.

@danmoseley
Copy link
Member Author

OK, changed from DataFlow to Channels. Super easy!

@jeffhandley jeffhandley merged commit 8e30f01 into dotnet:main Aug 3, 2021
@carlossanlop carlossanlop mentioned this pull request Oct 20, 2021
14 tasks
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.

3 participants
0