Skip to content

Commit a4cc797

Browse files
committed
Merge branch 'main' of github.com:github/stack-graphs into work/blusk/rkyv-storage
2 parents 8155fd7 + 7489606 commit a4cc797

File tree

7 files changed

+133
-56
lines changed

7 files changed

+133
-56
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data/*.tar.gz filter=lfs diff=lfs merge=lfs -text
2+
data/*.tgz filter=lfs diff=lfs merge=lfs -text
3+
data/*.zip filter=lfs diff=lfs merge=lfs -text

.github/workflows/ci.yml

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ on:
66
schedule:
77
- cron: "0 0 1,15 * *"
88

9+
# In the event that there is a new push to the ref, cancel any running jobs because there are now obsolete, and wasting resources.
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
914
jobs:
1015
test-rust:
11-
runs-on: ${{ matrix.os }}
16+
runs-on: ubuntu-latest
1217
strategy:
1318
matrix:
14-
os: [ubuntu-latest]
1519
rust: [stable]
1620

1721
steps:
@@ -85,7 +89,7 @@ jobs:
8589
languages: ${{ steps.language-list.outputs.languages }}
8690

8791
test-languages:
88-
needs: [list-languages, test-rust]
92+
needs: [list-languages]
8993
runs-on: ubuntu-latest
9094
strategy:
9195
matrix:
@@ -112,3 +116,61 @@ jobs:
112116
run: cargo build -p ${{ matrix.language }}
113117
- name: Test
114118
run: cargo test -p ${{ matrix.language }}
119+
120+
test-cli:
121+
runs-on: ubuntu-latest
122+
strategy:
123+
matrix:
124+
rust: [stable]
125+
env:
126+
TEST_NAME: typescript_minimal_project
127+
TSSG_TS: tree-sitter-stack-graphs-typescript
128+
129+
steps:
130+
- name: Install Rust environment
131+
uses: hecrj/setup-rust-action@v1
132+
with:
133+
rust-version: ${{ matrix.rust }}
134+
- name: Cache dependencies
135+
uses: actions/cache@v3
136+
with:
137+
path: |
138+
~/.cargo
139+
target
140+
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }}
141+
restore-keys: |
142+
${{ runner.OS }}-cargo-
143+
- name: Checkout code
144+
uses: actions/checkout@v3
145+
with:
146+
lfs: true
147+
- name: Build
148+
run: cargo build --release -p ${{ env.TSSG_TS }} --features cli
149+
- name: Checkout test code
150+
run: unzip ${{ env.TEST_NAME }}.zip
151+
working-directory: data
152+
- name: Index
153+
run: |
154+
target/release/${{ env.TSSG_TS }} index \
155+
-D data/${{ env.TEST_NAME }}.sqlite \
156+
--verbose \
157+
--hide-error-details \
158+
data/${{ env.TEST_NAME }}
159+
- name: Status
160+
run: |
161+
target/release/${{ env.TSSG_TS }} status \
162+
-D data/${{ env.TEST_NAME }}.sqlite \
163+
--all
164+
- name: Query
165+
run: |
166+
target/release/${{ env.TSSG_TS }} query \
167+
-D data/${{ env.TEST_NAME }}.sqlite \
168+
definition \
169+
data/${{ env.TEST_NAME }}/index.ts:3:10
170+
- name: Index (forced)
171+
run: |
172+
target/release/${{ env.TSSG_TS }} index \
173+
-D data/${{ env.TEST_NAME }}.sqlite \
174+
--verbose \
175+
--hide-error-details \
176+
data/${{ env.TEST_NAME }}

.github/workflows/perf.yml

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
pull_request:
44
paths:
55
- 'stack-graphs/**'
6+
7+
# In the event that there is a new push to the ref, cancel any running jobs because there are now obsolete, and wasting resources.
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
612
env:
713
BASE_REPO: ${{ github.event.pull_request.base.repo.owner.login }}/${{ github.event.pull_request.base.repo.name }}
814
BASE_SHA: ${{ github.event.pull_request.base.sha }}
@@ -14,10 +20,10 @@ env:
1420
HEAD_DIR: head
1521
HEAD_DB: head.sqlite
1622
HEAD_ARTIFACT: head-perf-results
23+
TEST_NAME: typescript_benchmark
1724
TEST_REPO: microsoft/TypeScript
1825
TEST_REF: v4.9.5
19-
TEST_DIR: test
20-
TEST_SRC: src/compiler
26+
TEST_SRC: src/compiler/utilities.ts
2127
MASSIF_OUT: perf.out
2228
MASSIF_REPORT: perf.txt
2329
TSSG_TS: tree-sitter-stack-graphs-typescript
@@ -40,6 +46,7 @@ jobs:
4046
ref: ${{ env.BASE_SHA }}
4147
path: ${{ env.BASE_DIR }}
4248
fetch-depth: 0
49+
lfs: false
4350
- name: Find last relevant base commit
4451
run: |
4552
printf 'BASE_SHA=%s\n' "$(git rev-list -1 ${{ env.BASE_SHA }} -- stack-graphs)" >> $GITHUB_ENV
@@ -51,6 +58,7 @@ jobs:
5158
ref: ${{ env.HEAD_SHA }}
5259
path: ${{ env.HEAD_DIR }}
5360
fetch-depth: 0
61+
lfs: false
5462
- name: "Find last relevant head commit"
5563
run: |
5664
printf 'HEAD_SHA=%s\n' "$(git rev-list -1 ${{ env.HEAD_SHA }} -- stack-graphs)" >> $GITHUB_ENV
@@ -60,7 +68,7 @@ jobs:
6068
uses: actions/cache/restore@v3
6169
with:
6270
path: done
63-
key: ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
71+
key: ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_NAME }}
6472
lookup-only: 'true'
6573

6674
##
@@ -73,9 +81,6 @@ jobs:
7381
env:
7482
BASE_SHA: ${{ needs.changes.outputs.base-sha }}
7583
steps:
76-
#
77-
# Install tools
78-
#
7984
- name: Install Rust environment
8085
uses: hecrj/setup-rust-action@v1
8186
with:
@@ -90,58 +95,45 @@ jobs:
9095
run: |
9196
sudo apt-get update
9297
sudo apt-get install -y valgrind
93-
#
94-
# Cache results
95-
#
9698
- name: "Cache base result"
9799
id: cache-base-result
98100
uses: actions/cache@v3
99101
with:
100102
path: |
101103
${{ env.MASSIF_OUT }}
102104
${{ env.MASSIF_REPORT }}
103-
key: ${{ runner.os }}-perf-result-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
104-
#
105-
# Checkout code
106-
#
105+
key: ${{ runner.os }}-perf-result-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.TEST_NAME }}
107106
- name: "Checkout base code"
108107
if: steps.cache-base-result.outputs.cache-hit != 'true'
109108
uses: actions/checkout@v3
110109
with:
111110
repository: ${{ env.BASE_REPO }}
112111
ref: ${{ env.BASE_SHA }}
113112
path: ${{ env.BASE_DIR }}
114-
#
115-
# Build code
116-
#
113+
lfs: true
117114
- name: "Build base CLI"
118115
if: steps.cache-base-result.outputs.cache-hit != 'true'
119116
run: cargo build --package ${{ env.TSSG_TS }} --features cli --release
120117
working-directory: ${{ env.BASE_DIR }}
121118
env:
122119
CARGO_PROFILE_RELEASE_DEBUG: true
123-
#
124-
# Test performance
125-
#
126-
- name: Checkout test code
120+
- name: Checkout benchmark code
127121
if: steps.cache-base-result.outputs.cache-hit != 'true'
128122
uses: actions/checkout@v3
129123
with:
130124
repository: ${{ env.TEST_REPO }}
131125
ref: ${{ env.TEST_REF }}
132-
path: ${{ env.TEST_DIR }}
126+
path: ${{ env.BASE_DIR }}/data/${{ env.TEST_NAME }}
133127
- name: Profile base memory
134128
if: steps.cache-base-result.outputs.cache-hit != 'true'
135129
run: |
136130
valgrind \
137131
--tool=massif \
138132
--massif-out-file=${{ env.MASSIF_OUT }} \
139133
${{ env.BASE_DIR }}/target/release/${{ env.TSSG_TS }} \
140-
index -D ${{ env.BASE_DB }} --max-file-time=30 --hide-error-details -- ${{ env.TEST_DIR }}/${{ env.TEST_SRC }}
134+
index -D ${{ env.BASE_DB }} --max-file-time=30 --hide-error-details -- \
135+
${{ env.BASE_DIR }}/data/${{ env.TEST_NAME }}/${{ env.TEST_SRC }}
141136
ms_print ${{ env.MASSIF_OUT }} > ${{ env.MASSIF_REPORT }}
142-
#
143-
# Upload results
144-
#
145137
- name: Upload results
146138
uses: actions/upload-artifact@v3
147139
with:
@@ -160,9 +152,6 @@ jobs:
160152
env:
161153
HEAD_SHA: ${{ needs.changes.outputs.head-sha }}
162154
steps:
163-
#
164-
# Install tools
165-
#
166155
- name: Install Rust environment
167156
uses: hecrj/setup-rust-action@v1
168157
with:
@@ -177,58 +166,43 @@ jobs:
177166
run: |
178167
sudo apt-get update
179168
sudo apt-get install -y valgrind
180-
#
181-
# Cache results
182-
#
183169
- name: "Cache head result"
184170
id: cache-head-result
185171
uses: actions/cache@v3
186172
with:
187173
path: |
188174
${{ env.MASSIF_OUT }}
189175
${{ env.MASSIF_REPORT }}
190-
key: ${{ runner.os }}-perf-result-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
191-
#
192-
# Checkout code
193-
#
176+
key: ${{ runner.os }}-perf-result-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_NAME }}
194177
- name: "Checkout head code"
195178
if: steps.cache-head-result.outputs.cache-hit != 'true'
196179
uses: actions/checkout@v3
197180
with:
198181
repository: ${{ env.HEAD_REPO }}
199182
ref: ${{ env.HEAD_SHA }}
200183
path: ${{ env.HEAD_DIR }}
201-
#
202-
# Build code
203-
#
184+
lfs: true
204185
- name: "Build head CLI"
205186
if: steps.cache-head-result.outputs.cache-hit != 'true'
206187
run: cargo build --package ${{ env.TSSG_TS }} --features cli --release
207188
working-directory: ${{ env.HEAD_DIR }}
208189
env:
209190
CARGO_PROFILE_RELEASE_DEBUG: true
210-
#
211-
# Test performance
212-
#
213-
- name: Checkout test code
191+
- name: Checkout benchmark code
214192
if: steps.cache-head-result.outputs.cache-hit != 'true'
215-
uses: actions/checkout@v3
216-
with:
217-
repository: ${{ env.TEST_REPO }}
218-
ref: ${{ env.TEST_REF }}
219-
path: ${{ env.TEST_DIR }}
193+
run: |
194+
unzip ${{ env.TEST_NAME }}.zip
195+
working-directory: ${{ env.HEAD_DIR }}/data
220196
- name: Profile head memory
221197
if: steps.cache-head-result.outputs.cache-hit != 'true'
222198
run: |
223199
valgrind \
224200
--tool=massif \
225201
--massif-out-file=${{ env.MASSIF_OUT }} \
226202
${{ env.HEAD_DIR }}/target/release/${{ env.TSSG_TS }} \
227-
index -D ${{ env.HEAD_DB }} --max-file-time=30 --hide-error-details -- ${{ env.TEST_DIR }}/${{ env.TEST_SRC }}
203+
index -D ${{ env.HEAD_DB }} --max-file-time=30 --hide-error-details -- \
204+
${{ env.HEAD_DIR }}/data/${{ env.TEST_NAME }}
228205
ms_print ${{ env.MASSIF_OUT }} > ${{ env.MASSIF_REPORT }}
229-
#
230-
# Upload results
231-
#
232206
- name: Upload results
233207
uses: actions/upload-artifact@v3
234208
with:
@@ -285,7 +259,7 @@ jobs:
285259
${{ env.SRC_DIR }}/script/ci-perf-summary-md \
286260
${{ env.BASE_ARTIFACT }}/${{ env.MASSIF_OUT }} \
287261
${{ env.HEAD_ARTIFACT }}/${{ env.MASSIF_OUT }} \
288-
'Comparing base ${{ env.BASE_REPO }}@${{ env.BASE_SHA }} with head ${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }} on [${{ env.TEST_REPO }}@${{ env.TEST_REF }}](${{ github.server_url }}/${{ env.TEST_REPO }}/tree/${{ env.TEST_REF }}). For details see [workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) artifacts. _Note that performance is tested on the last commits with changes in `stack-graphs`, not on every commit._' \
262+
'Comparing base ${{ env.BASE_REPO }}@${{ env.BASE_SHA }} with head ${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }} on ${{ env.TEST_NAME }} benchmark. For details see [workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) artifacts. _Note that performance is tested on the last commits with changes in `stack-graphs`, not on every commit._' \
289263
| ${{ env.SRC_DIR }}/script/ci-comment-json > ${{ env.COMMENT_JSON }}
290264
- name: Add summary comment to PR
291265
run: |
@@ -302,4 +276,4 @@ jobs:
302276
uses: actions/cache/save@v3
303277
with:
304278
path: done
305-
key: ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
279+
key: ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_NAME }}

data/typescript_benchmark.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Performance Benchmark
2+
3+
A set of files, taken from the TypeScript compiler v4.9.5, of different sizes:
4+
5+
```
6+
15 text files.
7+
15 unique files.
8+
0 files ignored.
9+
10+
github.com/AlDanial/cloc v 1.96 T=0.12 s (121.5 files/s, 250225.1 lines/s)
11+
---------------------------------------------------------------------------------------------
12+
File blank comment code
13+
---------------------------------------------------------------------------------------------
14+
typescript_benchmark/types.ts 1085 1548 6642
15+
typescript_benchmark/nodeFactory.ts 598 758 5544
16+
typescript_benchmark/es2015.ts 477 1082 2861
17+
typescript_benchmark/generators.ts 301 903 1985
18+
typescript_benchmark/module.ts 173 394 1437
19+
typescript_benchmark/system.ts 204 546 1195
20+
typescript_benchmark/resolutionCache.ts 112 101 920
21+
typescript_benchmark/sourcemap.ts 99 47 614
22+
typescript_benchmark/utilities.ts 64 92 371
23+
typescript_benchmark/emitNode.ts 35 87 172
24+
typescript_benchmark/es5.ts 10 40 72
25+
typescript_benchmark/node.ts 14 4 66
26+
typescript_benchmark/builderPublic.ts 8 117 56
27+
typescript_benchmark/es2019.ts 4 1 33
28+
typescript_benchmark/builderStatePublic.ts 1 0 13
29+
---------------------------------------------------------------------------------------------
30+
SUM: 3185 5720 21981
31+
---------------------------------------------------------------------------------------------
32+
```

data/typescript_benchmark.zip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:fc602330764f803afe9b30a8848c053fce2a94719226590cf951a2c7fd7ea6fd
3+
size 238818

data/typescript_minimal_project.zip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:6e352dc107e4aafdf417fd2cbbb1d027f0d3bda4beb47e9a7fca26f6a743401f
3+
size 1117

stack-graphs/force-perf-test

Whitespace-only changes.

0 commit comments

Comments
 (0)