Skip to content

Commit 5696fc5

Browse files
CopilotBrooooooklyn
andcommitted
Replace CI benchmark with real-world AFFiNE dataset approach
- Updated .github/workflows/CI.yml to clone AFFiNE v0.23.2 directly in CI - Install hyperfine for statistical benchmarking - Collect JS/TS files from AFFiNE source as benchmark data - Use new affine_bench binary instead of cargo bench - Run both quick comparison and hyperfine statistical benchmarks - Maintains aarch64 target optimization with native CPU flags Co-authored-by: Brooooooklyn <[email protected]>
1 parent 09179ce commit 5696fc5

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

.github/workflows/CI.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,38 @@ jobs:
1818
targets: 'aarch64-unknown-linux-gnu'
1919
env:
2020
CARGO_INCREMENTAL: '1'
21-
- name: Run benchmarks
22-
run: cargo bench
21+
- name: Install hyperfine
22+
run: |
23+
curl -L https://github.com/sharkdp/hyperfine/releases/download/v1.18.0/hyperfine-v1.18.0-aarch64-unknown-linux-gnu.tar.gz | tar xz
24+
sudo mv hyperfine-v1.18.0-aarch64-unknown-linux-gnu/hyperfine /usr/local/bin/
25+
- name: Clone AFFiNE v0.23.2 for benchmark data
26+
run: |
27+
mkdir -p /tmp/affine && cd /tmp/affine
28+
curl -L "https://github.com/toeverything/AFFiNE/archive/refs/tags/v0.23.2.tar.gz" -o affine-v0.23.2.tar.gz
29+
tar -xzf affine-v0.23.2.tar.gz
30+
- name: Collect benchmark data
31+
run: |
32+
mkdir -p benchmark_data
33+
find /tmp/affine/AFFiNE-0.23.2 -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -type f | \
34+
while IFS= read -r file; do
35+
echo "// File: $file" >> benchmark_data/all_files.js
36+
cat "$file" >> benchmark_data/all_files.js
37+
echo -e "\n\n" >> benchmark_data/all_files.js
38+
done
39+
find /tmp/affine/AFFiNE-0.23.2 -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -type f > benchmark_data/file_list.txt
40+
echo "Collected $(wc -l < benchmark_data/file_list.txt) files ($(wc -c < benchmark_data/all_files.js) bytes)"
41+
- name: Build benchmark binary
42+
run: cargo build --release --bin affine_bench
43+
env:
44+
RUSTFLAGS: '-C target-cpu=native'
45+
- name: Run real-world benchmarks
46+
run: |
47+
echo "=== Quick Comparison ==="
48+
./target/release/affine_bench compare
49+
echo ""
50+
echo "=== Hyperfine Benchmark ==="
51+
hyperfine --warmup 3 --runs 10 \
52+
--command-name "SIMD implementation" "./target/release/affine_bench hyperfine simd" \
53+
--command-name "Fallback implementation" "./target/release/affine_bench hyperfine fallback"
2354
env:
2455
RUSTFLAGS: '-C target-cpu=native'

0 commit comments

Comments
 (0)