Skip to content

Commit

Permalink
Perform memory profiling and comparison benchmarking for pull request…
Browse files Browse the repository at this point in the history
…s (FF-1563)
  • Loading branch information
leoromanovsky committed Feb 14, 2024
1 parent 46c78ac commit 67ffcb3
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 2 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/memory-profile-compare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Memory Profile Comparison

on: pull_request

jobs:
compare-memory-profiles:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
ref: 'main'

- name: Set up Go (main branch)
uses: actions/setup-go@v2
with:
go-version: '1.19'

- name: Generate memory profile for main branch
run: make profile-memory OUTFILE_SUFFIX=.main

- name: Save main branch memory profile
uses: actions/upload-artifact@v2
with:
name: memprofile-main
path: memprofile.main.out

- name: Checkout feature branch
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Set up Go (feature branch)
uses: actions/setup-go@v2
with:
go-version: '1.19'

- name: Generate memory profile for feature branch
run: |
make profile-memory OUTFILE_SUFFIX=.feat
- name: Save main branch memory profile
uses: actions/upload-artifact@v2
with:
name: memprofile-feat
path: memprofile.feat.out

- name: Download main branch memory profile
uses: actions/download-artifact@v2
with:
name: memprofile-main
path: .

- name: Compare memory profiles
run: make profile-memory-compare BASE_FILE=memprofile.main.out COMPARE_FILE=memprofile.feat.out > comparison.text

- name: Upload comparison result
uses: actions/upload-artifact@v2
with:
name: memory-profile-comparison
path: comparison.text
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ eppoclient/test-data
.vscode

.DS_Store
memprofile*
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ lint:

## profile-memory - Run test and generate memory profile
profile-memory:
echo "Run test and generate memory profile"
@cd eppoclient && \
{ \
echo "Using OUTFILE_SUFFIX: $$OUTFILE_SUFFIX"; \
go test -run Test_e2e -memprofile ../memprofile$$OUTFILE_SUFFIX.out ./...; \
go tool pprof -text -nodecount=50 ../memprofile$$OUTFILE_SUFFIX.out > ../memprofile$$OUTFILE_SUFFIX.text; \
}

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

0 comments on commit 67ffcb3

Please sign in to comment.