-
Notifications
You must be signed in to change notification settings - Fork 53
/
run-c-kzg-4844-benches.sh
executable file
·91 lines (68 loc) · 1.94 KB
/
run-c-kzg-4844-benches.sh
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
#!/bin/bash
set -e
print_msg () {
echo "[*]" "$1"
}
###################### parallel & backend configuration ######################
parallel=false
backend="unknown"
while [[ -n $# ]]; do
case $1 in
-p|--parallel)
parallel=true
;;
blst|arkworks|arkworks3|mcl|zkcrypto|constantine)
backend="$1"
;;
*)
break
;;
esac
shift
done
if [ "$backend" == "unknown" ]; then
echo "Unknown backend: $backend"
exit 1
fi
###################### building static libs ######################
print_msg "Selected backend: $backend"
print_msg "Compiling rust-kzg-$backend"
cd $backend
if [[ "$parallel" = true ]]; then
print_msg "Using parallel version"
cargo rustc --release --crate-type=staticlib --features=parallel
else
print_msg "Using non-parallel version"
cargo rustc --release --crate-type=staticlib
fi
mv ../target/release/librust_kzg_$backend.a ../target/release/rust_kzg_$backend.a
###################### cloning c-kzg-4844 ######################
print_msg "Cloning c-kzg-4844"
git clone https://github.com/ethereum/c-kzg-4844.git
cd c-kzg-4844 || exit
git -c advice.detachedHead=false checkout "$C_KZG_4844_GIT_HASH"
git submodule update --init
###################### rust benchmarks ######################
print_msg "Patching rust binding"
git apply < ../rust.patch
cd bindings/rust || exit
print_msg "Running rust benchmarks"
cargo bench
cd ../..
###################### java benchmarks ######################
print_msg "Patching java binding"
git apply < ../java.patch
cd bindings/java || exit
print_msg "Running java benchmarks"
make build benchmark
cd ../..
###################### go benchmarks ######################
print_msg "Patching go binding"
git apply < ../go.patch
cd bindings/go || exit
print_msg "Running go benchmarks"
CGO_CFLAGS="-O2 -D__BLST_PORTABLE__" go test -run ^$ -bench .
cd ../../..
###################### cleaning up ######################
print_msg "Cleaning up"
rm -rf c-kzg-4844