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

Resolve shell env API performance issue for single env approach - bash #238488

Merged
merged 28 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5527b85
try to come up with diff approach
anthonykim1 Jan 22, 2025
960aeda
add fasher bash code
anthonykim1 Jan 22, 2025
290e0cd
use grep
anthonykim1 Jan 22, 2025
d3ef701
instant bash is back!
anthonykim1 Jan 22, 2025
fbb47d6
format things better
anthonykim1 Jan 22, 2025
9ffe2d1
show perf in seconds
anthonykim1 Jan 22, 2025
f6863cb
bring back TS side - TS side has no impact on perf
anthonykim1 Jan 22, 2025
f4e820c
Revert "bring back TS side - TS side has no impact on perf"
anthonykim1 Jan 22, 2025
39993b4
better comments
anthonykim1 Jan 22, 2025
73c6045
cleaner
anthonykim1 Jan 23, 2025
c6832d8
comment clean up
anthonykim1 Jan 23, 2025
3386a5b
add way to track missing variable in bash side
anthonykim1 Jan 23, 2025
a00560f
EnvSingleDelete
anthonykim1 Jan 23, 2025
9c213c5
better logic
anthonykim1 Jan 23, 2025
7787b0e
Todos
Tyriar Jan 23, 2025
41df1b6
bring back env in command_complete DO NOT USE CUT as hinders perf
anthonykim1 Jan 24, 2025
8d8bf63
do not diff for first time
anthonykim1 Jan 24, 2025
224bfcf
use 1,0 over true,false AND use builtin unset
anthonykim1 Jan 24, 2025
84eb38c
use associative array depending on bash > 4.0
anthonykim1 Jan 25, 2025
6ae1011
clean up - associative approach completed
anthonykim1 Jan 25, 2025
ad4367f
get ready for review
anthonykim1 Jan 25, 2025
76edbf3
dont leave a mess
anthonykim1 Jan 25, 2025
661b765
VSCODE_DISABLE_ENV_REPORTING and bash version
anthonykim1 Jan 27, 2025
b4ad9c1
undo irrelevant change
anthonykim1 Feb 10, 2025
926673b
Merge branch 'main' into anthonykim1/improveEnvPerf
Tyriar Feb 11, 2025
0ceffbb
Update src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
Tyriar Feb 11, 2025
2138e95
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
Tyriar Feb 11, 2025
7ae53bb
add prefix
anthonykim1 Feb 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
better logic
  • Loading branch information
anthonykim1 committed Jan 23, 2025
commit 9c213c503ee6adb96f8e7816959b685c09e1b190
Original file line number Diff line number Diff line change
@@ -69,13 +69,11 @@ export class ShellEnvDetectionCapability extends Disposable implements IShellEnv
if (key !== undefined && value !== undefined) {
this._env.delete(key);
this._pendingEnv?.delete(key);
this._onDidChangeEnv.fire(this._env);
}
return;
}

// Check for environment differs, and was updated.
// This way we only fire an event if the environment actually changed.
// Make sure to update this.env to the latest, fire event if there is a diff
applyEnvironmentDiff(env: Map<string, string>, isTrusted: boolean): void {
if (!isTrusted) {
return;
@@ -86,7 +84,10 @@ export class ShellEnvDetectionCapability extends Disposable implements IShellEnv
for (const [key, value] of env.entries()) {
if (this._env.has(key) && this._env.get(key) === value) {
// Do nothing
} else if (value !== undefined) {
} else if (this.env.has(key) && value !== this.env.get(key)) {
this._env.set(key, value);
envDiffers = true;
} else if (!this.env.has(key)) {
this._env.set(key, value);
envDiffers = true;
}
Original file line number Diff line number Diff line change
@@ -278,14 +278,12 @@ __vsc_update_env() {
updateEnvCache "$key" "$value"
done < <(env)

trackMissingEnvVars

builtin printf '\e]633;EnvSingleEnd;%s;\a' $__vsc_nonce

end_time=$(date +%s)
elapsed_time=$(($end_time - $start_time))

# builtin printf "Time taken: $elapsed_time seconds\n"

trackMissingEnvVars
builtin printf "Time taken: $elapsed_time seconds\n"
}