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

Remove usages of TaskQueue #76453

Merged
merged 3 commits into from
Dec 16, 2024
Merged

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 16, 2024 22:15
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 16, 2024
}

File.AppendAllText(_logFilePath, _buffer.ToString());
_buffer.Clear();
Copy link
Member

Choose a reason for hiding this comment

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

It looks like _buffer can go away at this point; before it was collecting stuff until it got written, now it's just being used as a local here. And we could just directly do the writing to a file to avoid the giant string allocation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like it's trying to do a single write, instead of N smaller writes. I have no issue keeping this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of like Jason's suggestion too, it can still be a single call into the File API, something like:

            var now = DateTime.Now;
            File.AppendAllLines(_logFilePath, list.Select((functionId, message) => $"{now} ({functionId}) : {message}"));

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we separate out core parts of PRs, vs nice to haves? I'm fine with potentially making this change in a future PR, or having one of you guys do it. The core goal here is simplifying the threading primitives. I don't want to be iterating a lot on making extra changes that take away from that work.

Please separate out nits and suggestions, from requirements for a PR to go in. Thanks @jasonmalinowski @ToddGrun

Copy link
Member

Choose a reason for hiding this comment

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

@CyrusNajmabadi Even if we don't want to optimize, at least move _buffer to a local. Otherwise we're leaving a field around that doesn't need to be a field, and looks like there's more complexity than there is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can make this change in a followup PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 052c7ee

@CyrusNajmabadi CyrusNajmabadi merged commit f90fe25 into dotnet:main Dec 16, 2024
25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the removeTaskQueue branch December 16, 2024 23:46
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 16, 2024
@dibarbet dibarbet modified the milestones: Next, 17.13 P3 Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants