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

use local cache instead of localStorage to get repo status #5798

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

hitesh-1997
Copy link
Contributor

@hitesh-1997 hitesh-1997 commented Oct 3, 2024

Context

Fixes #5787 and #5780

  1. The PR removes the caching introduced in the vscode localStorage in the PR to get the repo status, and uses local cache to store the results.
  2. get request from localStorage was being triggered for every logging request here causing the slowness in vscode workspace.

Test plan

Do this test before and after the PR commits.

  1. Open multiple workspace in vscode in the debug mode.
  2. Follow the steps listed by @arafatkatze here to get the cpu profiling data.
  3. Type something really fast. We should be able to see the lags introduced when typing.
  4. In addition, use https://www.speedscope.app/ to visualize the profiling data gathered.
  5. Profiling data before/after this PR
image

Logs Link:

  1. after_pr_change.cpuprofile.txt
  2. before_pr_change.cpuprofile.txt

Changelog

  • Fixes the vscode slowness issue when completions is turned on.

@hitesh-1997 hitesh-1997 merged commit 06f62e3 into main Oct 3, 2024
18 checks passed
@hitesh-1997 hitesh-1997 deleted the hitesh/fix-slowness-for-completions branch October 3, 2024 22:47
hitesh-1997 added a commit that referenced this pull request Oct 3, 2024
## Context
Fixes #5787 and
#5780
1. The PR removes the caching introduced in the vscode `localStorage` in
the
[PR](https://github.com/sourcegraph/cody/pull/5767/files#diff-795b77ed195550f3e764295bad38afdec49b0f2ad96476c63c945df119b561f7R40)
to get the repo status, and uses local cache to store the results.
2. get request from `localStorage` was being triggered for every logging
request
[here](https://github.com/sourcegraph/cody/blob/main/vscode/src/completions/logger.ts#L741)
causing the slowness in vscode workspace.

## Test plan
Do this test before and after the PR commits.
1. Open multiple workspace in vscode in the debug mode.
2. Follow the steps listed by @arafatkatze
[here](#5787 (comment))
to get the cpu profiling data.
4. Type something really fast. We should be able to see the lags
introduced when typing.
5. In addition, use https://www.speedscope.app/ to visualize the
profiling data gathered.
6. Profiling data before/after this PR

<img width="1512" alt="image"
src="https://github.com/user-attachments/assets/1056adbf-d57e-4470-b553-06fab83470a1">

Logs Link:
1.
[after_pr_change.cpuprofile.txt](https://github.com/user-attachments/files/17250317/after_pr_change.cpuprofile.txt)
2.
[before_pr_change.cpuprofile.txt](https://github.com/user-attachments/files/17250318/before_pr_change.cpuprofile.txt)


## Changelog
- Fixes the vscode slowness issue when completions is turned on.
This was referenced Oct 3, 2024
hitesh-1997 added a commit that referenced this pull request Oct 3, 2024
- Autocomplete: The PR fixes the slowness in vscode because because of
completions by using local cache instead of querying vscode
localStorage. [pull/5798](#5798)

## Test plan
Cherry pick the PR
[pull/5798](#5798).
hitesh-1997 added a commit that referenced this pull request Oct 3, 2024
## Context
Fixes #5787 and
#5780
1. The PR removes the caching introduced in the vscode `localStorage` in
the
[PR](https://github.com/sourcegraph/cody/pull/5767/files#diff-795b77ed195550f3e764295bad38afdec49b0f2ad96476c63c945df119b561f7R40)
to get the repo status, and uses local cache to store the results.
2. get request from `localStorage` was being triggered for every logging
request
[here](https://github.com/sourcegraph/cody/blob/main/vscode/src/completions/logger.ts#L741)
causing the slowness in vscode workspace.

## Test plan
Do this test before and after the PR commits.
1. Open multiple workspace in vscode in the debug mode.
2. Follow the steps listed by @arafatkatze
[here](#5787 (comment))
to get the cpu profiling data.
4. Type something really fast. We should be able to see the lags
introduced when typing.
5. In addition, use https://www.speedscope.app/ to visualize the
profiling data gathered.
6. Profiling data before/after this PR

<img width="1512" alt="image"
src="https://github.com/user-attachments/assets/1056adbf-d57e-4470-b553-06fab83470a1">

Logs Link:
1.
[after_pr_change.cpuprofile.txt](https://github.com/user-attachments/files/17250317/after_pr_change.cpuprofile.txt)
2.
[before_pr_change.cpuprofile.txt](https://github.com/user-attachments/files/17250318/before_pr_change.cpuprofile.txt)


## Changelog
- Fixes the vscode slowness issue when completions is turned on.
hitesh-1997 added a commit that referenced this pull request Oct 4, 2024
- Autocomplete: The PR fixes the slowness in vscode because because of
completions by using local cache instead of querying vscode
localStorage. [pull/5798](#5798)
- Sourcegraph API GraphQL: Increase the default timeout from 6sec to
20sec. [pull/5789](#5789)

## Test plan
Cherry-pick commits & update changelog, version

---------

Co-authored-by: Quinn Slack <quinn@slack.org>
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.

Extension causes high cpu load
2 participants