Skip to content

Commit ad112bc

Browse files
authored
perf test tsgo (#118)
1 parent dabd7c1 commit ad112bc

File tree

128 files changed

+3238
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3238
-60
lines changed

build/benchmark.yml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ resources:
4141
type: github
4242
endpoint: Microsoft
4343
name: microsoft/TypeScript
44+
- repository: typescript-go
45+
type: github
46+
endpoint: Microsoft
47+
name: microsoft/typescript-go
4448

4549
# https://stackoverflow.com/a/63276774
4650
pipelines:
@@ -85,6 +89,10 @@ parameters:
8589
displayName: Exhaustive list of agents
8690
type: string
8791
default: 'any,ts-perf1,ts-perf2,ts-perf3,ts-perf4,ts-perf5,ts-perf6,ts-perf7,ts-perf8,ts-perf9,ts-perf10,ts-perf11,ts-perf12'
92+
- name: TS_GO
93+
displayName: boolean to describe if building ts-go
94+
type: boolean
95+
default: false
8896

8997
variables:
9098
Codeql.Enabled: false
@@ -95,7 +103,15 @@ variables:
95103
azureSubscription: 'TypeScript Public CI'
96104
KeyVaultName: 'jststeam-passwords'
97105

98-
REF: $[ resources.repositories['TypeScript'].ref ]
106+
${{ if eq(parameters.TS_GO, true) }}:
107+
REPO: 'typescript-go'
108+
REF: $[ replace(resources.repositories['typescript-go'].ref, 'heads/../', '') ]
109+
TSGOFLAG: '--tsgo'
110+
${{ else }}:
111+
REPO: 'TypeScript'
112+
REF: $[ replace(resources.repositories['TypeScript'].ref, 'heads/../', '') ]
113+
TSGOFLAG: ''
114+
99115
PRETTY_REF: $[ replace(replace(replace(replace(variables['REF'], '/merge', ''), 'refs/pull/', 'pr.'), 'refs/heads/', ''), '/', '_') ]
100116
IS_PR: $[ startsWith(variables['REF'], 'refs/pull/') ]
101117
# True if this run should demand a baseline machine.
@@ -122,19 +138,27 @@ jobs:
122138

123139
variables:
124140
ARTIFACTS_DIR: $(Pipeline.Workspace)/artifacts
125-
TYPESCRIPT_DIR: $(Pipeline.Workspace)/TypeScript
141+
TYPESCRIPT_DIR: $(Pipeline.Workspace)/$(REPO)
126142
TSPERF_PRESET: ${{ parameters.TSPERF_PRESET }}
127143

128144
steps:
129145
- template: templates/setup.yml
130146
- template: templates/cloneAndBuildBenchmarkRepo.yml # Sets $(BENCH_SCRIPTS), $(TSPERF_EXE)
131147

132-
- checkout: TypeScript
133-
path: TypeScript
134-
fetchTags: false
135-
fetchDepth: 2 # For PRs, we want the merge base to compare against.
136-
clean: true
137-
retryCountOnTaskFailure: 3
148+
- ${{ if eq(parameters.TS_GO, true) }}:
149+
- checkout: typescript-go
150+
path: typescript-go
151+
fetchTags: false
152+
fetchDepth: 2 # For PRs, we want the merge base to compare against.
153+
clean: true
154+
retryCountOnTaskFailure: 3
155+
- ${{ else }}:
156+
- checkout: TypeScript
157+
path: TypeScript
158+
fetchTags: false
159+
fetchDepth: 2 # For PRs, we want the merge base to compare against.
160+
clean: true
161+
retryCountOnTaskFailure: 3
138162

139163
# Ideally we'd just do this:
140164
# git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
@@ -146,7 +170,7 @@ jobs:
146170
set -exo pipefail
147171
OLD_REF=`git -C $(TYPESCRIPT_DIR) rev-parse HEAD`
148172
rm -rf $(TYPESCRIPT_DIR)
149-
git clone --filter=blob:none https://github.com/microsoft/TypeScript $(TYPESCRIPT_DIR)
173+
git clone --filter=blob:none https://github.com/microsoft/$(REPO) $(TYPESCRIPT_DIR)
150174
cd $(TYPESCRIPT_DIR)
151175
git fetch origin $(OLD_REF)
152176
git switch --detach FETCH_HEAD
@@ -160,6 +184,8 @@ jobs:
160184
node $(BENCH_SCRIPTS)/setupPipeline.js
161185
displayName: Setup pipeline
162186
name: setupPipeline
187+
env:
188+
TSGOFLAG: $(TSGOFLAG)
163189
164190
- bash: |
165191
set -exo pipefail
@@ -170,7 +196,7 @@ jobs:
170196
171197
- bash: |
172198
set -exo pipefail
173-
node $(BENCH_SCRIPTS)/buildTypeScript.js --outputDir $(ARTIFACTS_DIR)/new
199+
node $(BENCH_SCRIPTS)/buildTypeScript.js --outputDir $(ARTIFACTS_DIR)/new $(TSGOFLAG)
174200
displayName: Build new TypeScript
175201
condition: and(succeeded(), eq(variables['TSPERF_IS_COMPARISON'], 'true'))
176202
workingDirectory: $(TYPESCRIPT_DIR)
@@ -185,7 +211,7 @@ jobs:
185211
186212
- bash: |
187213
set -exo pipefail
188-
node $(BENCH_SCRIPTS)/buildTypeScript.js --baseline --outputDir $(ARTIFACTS_DIR)/baseline
214+
node $(BENCH_SCRIPTS)/buildTypeScript.js --baseline --outputDir $(ARTIFACTS_DIR)/baseline $(TSGOFLAG)
189215
displayName: Build baseline TypeScript
190216
workingDirectory: $(TYPESCRIPT_DIR)
191217
name: buildTypeScriptBaseline
@@ -226,6 +252,12 @@ jobs:
226252
artifact: BuiltTypeScript
227253
displayName: Download built TypeScript
228254

255+
- ${{ if eq(parameters.TS_GO, true) }}:
256+
- bash: |
257+
set -exo pipefail
258+
find $(BUILT_TYPESCRIPT_DIR) -name 'tsgo' -type f -exec chmod +x {} +
259+
displayName: Make tsgo executable
260+
229261
# This is provided by the agent.
230262
- bash: |
231263
set -exo pipefail
@@ -237,7 +269,6 @@ jobs:
237269
node $(BENCH_SCRIPTS)/runTsPerf.js install-hosts
238270
displayName: Install hosts
239271
retryCountOnTaskFailure: 3
240-
241272
- bash: |
242273
set -exo pipefail
243274
# Special case for self benchmark
@@ -397,7 +428,7 @@ jobs:
397428

398429
- bash: |
399430
set -exo pipefail
400-
node $(BENCH_SCRIPTS)/postPerfResult.js --fragment $(Pipeline.Workspace)/comment.html
431+
node $(BENCH_SCRIPTS)/postPerfResult.js --fragment $(Pipeline.Workspace)/comment.html $(TSGOFLAG)
401432
displayName: Publish PR comment
402433
condition: and(succeeded(), eq(variables['IS_PR'], 'true'))
403434
env:
@@ -480,7 +511,7 @@ jobs:
480511

481512
- bash: |
482513
set -exo pipefail
483-
node $(BENCH_SCRIPTS)/postPerfResult.js --failed
514+
node $(BENCH_SCRIPTS)/postPerfResult.js --failed $(TSGOFLAG)
484515
displayName: Publish PR comment
485516
env:
486517
DISTINCT_ID: ${{ parameters.DISTINCT_ID }}

build/templates/setup.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ steps:
88
inputs:
99
versionSpec: ${{ parameters.NODE_VERSION }}
1010
displayName: 'Install Node ${{ parameters.NODE_VERSION }}'
11+
- task: GoTool@0
12+
inputs:
13+
version: '1.26'
14+
displayName: 'Install Go'
1115

1216
- bash: |
1317
set -exo pipefail
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "Compiler-UnionsLSP",
3+
"kind": "lsp",
4+
"args": [],
5+
"tsserverConfig": {
6+
"solution": "Compiler-Unions",
7+
"commands": [
8+
{
9+
"commandName": "updateOpen",
10+
"args": [
11+
{
12+
"file": "checker.ts"
13+
}
14+
]
15+
},
16+
{
17+
"commandName": "geterr",
18+
"args": [
19+
"checker.ts"
20+
]
21+
},
22+
{
23+
"commandName": "references",
24+
"args": {
25+
"file": "checker.ts",
26+
"line": 10960,
27+
"offset": 48
28+
}
29+
},
30+
{
31+
"commandName": "navto",
32+
"args": {
33+
"searchValue": "Type"
34+
}
35+
},
36+
{
37+
"commandName": "completionInfo",
38+
"args": {
39+
"file": "checker.ts",
40+
"line": 25149,
41+
"offset": 6
42+
}
43+
}
44+
]
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "CompilerLSP",
3+
"kind": "lsp",
4+
"args": [],
5+
"tsserverConfig": {
6+
"solution": "Compiler",
7+
"commands": [
8+
{
9+
"commandName": "updateOpen",
10+
"args": [
11+
{
12+
"file": "checker.ts"
13+
}
14+
]
15+
},
16+
{
17+
"commandName": "geterr",
18+
"args": [
19+
"checker.ts"
20+
]
21+
},
22+
{
23+
"commandName": "references",
24+
"args": {
25+
"file": "checker.ts",
26+
"line": 11696,
27+
"offset": 48
28+
}
29+
},
30+
{
31+
"commandName": "navto",
32+
"args": {
33+
"searchValue": "Type"
34+
}
35+
},
36+
{
37+
"commandName": "completionInfo",
38+
"args": {
39+
"file": "checker.ts",
40+
"line": 26636,
41+
"offset": 6
42+
}
43+
}
44+
]
45+
}
46+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "lsp-startup",
3+
"kind": "startup",
4+
"args": [
5+
"tsgo",
6+
"--lsp",
7+
"--stdio",
8+
"--disableAutomaticTypingAcquisition"
9+
]
10+
}

cases/scenarios/self-build-src-public-api/setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ cd "${0%/*}"
55

66
source ../../common.sh
77

8-
clone_scenario https://github.com/microsoft/TypeScript.git $TYPESCRIPT_COMMIT
8+
if [ -n "$TSGOFLAG" ]; then
9+
clone_scenario https://github.com/microsoft/TypeScript.git tsgo-port
10+
else
11+
clone_scenario https://github.com/microsoft/TypeScript.git $TYPESCRIPT_COMMIT
12+
fi
913

1014
run_sandboxed sh -c '
1115
npm ci

cases/scenarios/self-build-src/setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ cd "${0%/*}"
55

66
source ../../common.sh
77

8-
clone_scenario https://github.com/microsoft/TypeScript.git $TYPESCRIPT_COMMIT
8+
if [ -n "$TSGOFLAG" ]; then
9+
clone_scenario https://github.com/microsoft/TypeScript.git tsgo-port
10+
else
11+
clone_scenario https://github.com/microsoft/TypeScript.git $TYPESCRIPT_COMMIT
12+
fi
913

1014
run_sandboxed sh -c '
1115
npm ci

cases/scenarios/self-compiler/setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ cd "${0%/*}"
55

66
source ../../common.sh
77

8-
clone_scenario https://github.com/microsoft/TypeScript.git $TYPESCRIPT_COMMIT
8+
if [ -n "$TSGOFLAG" ]; then
9+
clone_scenario https://github.com/microsoft/TypeScript.git tsgo-port
10+
else
11+
clone_scenario https://github.com/microsoft/TypeScript.git $TYPESCRIPT_COMMIT
12+
fi
913

1014
run_sandboxed sh -c '
1115
npm ci

cases/scenarios/tsc-startup/scenario.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "tsc-startup",
33
"kind": "startup",
44
"args": [
5-
"tsc.js",
5+
"tsc",
66
"--version"
77
]
88
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "tsgo-startup",
3+
"kind": "startup",
4+
"args": [
5+
"tsgo",
6+
"tsc",
7+
"--version"
8+
]
9+
}

0 commit comments

Comments
 (0)