-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (138 loc) · 4.65 KB
/
performance.yml
File metadata and controls
163 lines (138 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Performance Analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 2 * * 0' # Weekly on Sunday at 2 AM
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
pkg-config \
libcriterion-dev \
clang-18 \
linux-tools-generic \
valgrind \
time
- name: Build optimized version
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang-18 \
-DCMAKE_C_FLAGS="-O3 -march=native -fno-omit-frame-pointer"
cmake --build build --parallel
- name: Run benchmarks
run: |
# Multiple runs for statistical significance
for i in {1..5}; do
echo "=== Run $i ===" >> benchmark-results.txt
./build/bin/mg_benchmarks >> benchmark-results.txt
done
- name: Performance regression check
run: |
# Simple performance regression detection
# In real usage, you'd compare against baseline
LATEST_TIME=$(tail -10 benchmark-results.txt | grep "Graph creation" | tail -1 | awk '{print $4}')
echo "Latest graph creation time: $LATEST_TIME µs"
# Alert if performance degrades significantly (>20% slower than 2µs baseline)
if (( $(echo "$LATEST_TIME > 2.4" | bc -l) )); then
echo "::warning::Performance regression detected: $LATEST_TIME µs > 2.4 µs baseline"
fi
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark-results.txt
memory-profile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
pkg-config \
libcriterion-dev \
clang-18 \
valgrind
- name: Build with debug info
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang-18 \
-DMETAGRAPH_SANITIZERS=OFF # Disable for Valgrind
cmake --build build --parallel
- name: Memory leak detection
run: |
valgrind --tool=memcheck \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--error-exitcode=1 \
--log-file=valgrind-memcheck.log \
./build/bin/mg_unit_tests
- name: Cache performance analysis
run: |
valgrind --tool=cachegrind \
--cache-sim=yes \
--branch-sim=yes \
--cachegrind-out-file=cachegrind.out \
./build/bin/mg_benchmarks
- name: Upload memory analysis
uses: actions/upload-artifact@v4
with:
name: memory-analysis
path: |
valgrind-memcheck.log
cachegrind.out
fuzzing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake pkg-config clang-18
- name: Build fuzzing targets
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DMETAGRAPH_FUZZING=ON \
-DCMAKE_C_COMPILER=clang-18
cmake --build build --parallel
- name: Run continuous fuzzing
run: |
mkdir -p fuzz-corpus/{graph,node-ops}
# Run fuzzing for 5 minutes
timeout 300 ./build/tests/fuzz/fuzz_graph \
-max_total_time=300 \
-print_final_stats=1 \
fuzz-corpus/graph/ || true
timeout 300 ./build/tests/fuzz/fuzz_node_ops \
-max_total_time=300 \
-print_final_stats=1 \
fuzz-corpus/node-ops/ || true
- name: Upload fuzzing corpus
uses: actions/upload-artifact@v4
with:
name: fuzz-corpus
path: fuzz-corpus/
- name: Check for crashes
run: |
# Check if any crash files were generated
if find . -name "crash-*" -o -name "leak-*" -o -name "timeout-*" | grep -q .; then
echo "::error::Fuzzing found crashes or issues!"
find . -name "crash-*" -o -name "leak-*" -o -name "timeout-*" -exec echo "Found: {}" \;
exit 1
else
echo "::notice::No crashes found during fuzzing"
fi