KEMBAR78
Resolve shell env API performance issue for single env approach - bash by anthonykim1 · Pull Request #238488 · microsoft/vscode · GitHub
Skip to content

Conversation

anthonykim1
Copy link
Contributor

@anthonykim1 anthonykim1 commented Jan 22, 2025

Potential root of the performance cause:

  1. Using diff approach where we check for change the environment variables, and only firing an event if there is a difference, should resolve the problem
  2. O(n) - iterating through each environment variable in the process of fetching them (inside shell such as bash) is what is slow
  3. Print statements in the above O(n) is what is causing the slowness (shell side: e.g. bash side)
  4. O(n) - iterating through each environment variable when trying to calculate the diff is what is slow (in the shellEnvDetectionCapability)

Edit: d3ef701 brought back instant bash prompts. I think it was combination of printenv with compgen and tons of printf statements really slowing things down. So Mainly Scenario number 3 was correct

@anthonykim1 anthonykim1 self-assigned this Jan 22, 2025
@anthonykim1
Copy link
Contributor Author

anthonykim1 commented Jan 22, 2025

https://github.com/user-attachments/assets/57167cc9-fd5b-424b-b302-83542592365d
@Tyriar This is for bash, but I think I brought back the perf to normal

@anthonykim1 anthonykim1 requested a review from Tyriar January 26, 2025 22:40
@kieferrm kieferrm mentioned this pull request Jan 27, 2025
62 tasks
@anthonykim1
Copy link
Contributor Author

TODO: Should address #238338 (comment) if we were to enable shell env for bash again since it is critical.

@anthonykim1 anthonykim1 changed the title Resolve shell env API performance issue for single env approach Resolve shell env API performance issue for single env approach - bash Feb 10, 2025
@anthonykim1 anthonykim1 requested a review from Tyriar February 11, 2025 18:28
@anthonykim1 anthonykim1 merged commit c379705 into main Feb 11, 2025
8 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/improveEnvPerf branch February 11, 2025 19:39
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Mar 28, 2025
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.

2 participants