Skip to content

Commit 9f836c7

Browse files
Perform memory profiling and comparison benchmarking for pull requests (FF-1563) (#32)
1 parent 46c78ac commit 9f836c7

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Memory Profile Comparison
2+
3+
on: pull_request
4+
5+
jobs:
6+
compare-memory-profiles:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout main branch
10+
uses: actions/checkout@v2
11+
with:
12+
ref: 'main'
13+
14+
- name: Set up Go (main branch)
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: '1.19'
18+
19+
- name: Generate memory profile for main branch
20+
run: make profile-memory OUTFILE_SUFFIX=.main
21+
22+
- name: Save main branch memory profile
23+
uses: actions/upload-artifact@v2
24+
with:
25+
name: memprofile-main
26+
path: |
27+
memprofile.main.out
28+
memprofile.main.text
29+
30+
- name: Checkout feature branch
31+
uses: actions/checkout@v2
32+
with:
33+
ref: ${{ github.head_ref }}
34+
35+
- name: Set up Go (feature branch)
36+
uses: actions/setup-go@v2
37+
with:
38+
go-version: '1.19'
39+
40+
- name: Generate memory profile for feature branch
41+
run: make profile-memory OUTFILE_SUFFIX=.feat
42+
43+
- name: Save feat branch memory profile
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: memprofile-feat
47+
path: |
48+
memprofile.feat.out
49+
memprofile.feat.text
50+
51+
- name: Download main branch memory profile
52+
uses: actions/download-artifact@v2
53+
with:
54+
name: memprofile-main
55+
path: .
56+
57+
- name: Compare memory profiles
58+
run: make profile-memory-compare BASE_FILE=memprofile.main.out COMPARE_FILE=memprofile.feat.out > memory-profile-comparison.text
59+
60+
- name: Upload comparison result
61+
uses: actions/upload-artifact@v2
62+
with:
63+
name: memory-profile-comparison
64+
path: memory-profile-comparison.text

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ eppoclient/test-data
1818
.vscode
1919

2020
.DS_Store
21+
memprofile*

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ lint:
3434
golangci-lint run
3535

3636
## profile-memory - Run test and generate memory profile
37-
profile-memory:
38-
echo "Run test and generate memory profile"
37+
profile-memory: test-data
38+
@cd eppoclient && \
39+
{ \
40+
echo "Using OUTFILE_SUFFIX: $$OUTFILE_SUFFIX"; \
41+
go test -run Test_e2e -memprofile ../memprofile$$OUTFILE_SUFFIX.out ./...; \
42+
go tool pprof -text -nodecount=50 ../memprofile$$OUTFILE_SUFFIX.out > ../memprofile$$OUTFILE_SUFFIX.text; \
43+
}
3944

4045
## profile-memory-compare - Compare two memory profiles
4146
## example: make profile-memory-compare BASE_FILE=memprofile1.out FEAT_FILE=memprofile2.out
4247
profile-memory-compare:
43-
echo "Compare two memory profiles"
48+
go tool pprof -base $$BASE_FILE -text $$FEAT_FILE

0 commit comments

Comments
 (0)