Skip to content

Conversation

@nrayburn-tech
Copy link
Contributor

  • I modified the function to batch the requests, so that they are done in batches of 20. This is a bit less efficient than pooling the request, but I didn't think this really needed the extra complexity. I can use a pool instead, if it really matters.
  • Also modified a function return type to remove | undefined. This doesn't seem like a valid return type for that function and allowed some ifs to be removed, and a filter on the batching requests function.

I would expect using batches to reduce performance on workspaces that have a large number of .md files. I don't have a good way to test this for comparison though.

This PR fixes #124276.


this._watcher.onDidChange(async resource => {
const document = await this.getMarkdownDocument(resource);
if (document) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please make these changes in a separate PR? I'd like to keep this one scoped to just batching the requests

Copy link
Contributor Author

@nrayburn-tech nrayburn-tech left a comment

Choose a reason for hiding this comment

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

@mjbvz updated.

return docs.filter(doc => !!doc) as SkinnyTextDocument[];

// add 1 in case of any remaining files,
// ex (10 % 3) = 3, needs 1 more loop to complete
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this comment necessary?

const resourceBatch = resources.slice(i * maxConcurrent, (i + 1) * maxConcurrent);
(await Promise.all(resourceBatch.map(async doc => {
return await this.getMarkdownDocument(doc);
}))).filter((doc) => !!doc);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be broken up for readability?

Copy link

@james7618891 james7618891 left a comment

Choose a reason for hiding this comment

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

Visa

@mjbvz mjbvz added this to the July 2021 milestone Jul 1, 2021
@nrayburn-tech
Copy link
Contributor Author

@mjbvz should all be resolved now.

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Very small change but otherwise looks good for merging

@nrayburn-tech
Copy link
Contributor Author

@mjbvz updated with the change and merged upstream.

@mjbvz mjbvz modified the milestones: July 2021, August 2021 Jul 29, 2021
@mjbvz mjbvz merged commit 72d9aa6 into microsoft:main Aug 3, 2021
@mjbvz
Copy link
Collaborator

mjbvz commented Aug 3, 2021

Thanks! This is schooled to go out with VS Code 1.60 at the end of this month

@github-actions github-actions bot locked and limited conversation to collaborators Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit markdown having to scan over all markdown files in workspace for open symbol

4 participants