Skip to content

Commit

Permalink
make bench more fair
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Mar 7, 2024
1 parent b206ca7 commit a51d5d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bench/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ function bench_program() {

echo -e "### ${RED}Benchmarking $name ${NC}"

rustc --crate-type=cdylib "$name.rs" -C opt-level=3 -o "${name}_rs.so" > /dev/null 2>&1
rustc --crate-type=cdylib "$name.rs" -C target-cpu=native -C opt-level=3 -o "${name}_rs.so" > /dev/null 2>&1
cargo r -- "$name.con" --library --release > /dev/null 2>&1
cp "./build_artifacts/$name.so" "${name}_con.so"

cc bench.c -L . -l:./"${name}"_rs.so -l:./"${name}"_con.so -Wl,-rpath -o bench_"${name}"
cc -march=native -mtune=native bench.c -L . -l:./"${name}"_rs.so -l:./"${name}"_con.so -Wl,-rpath -o bench_"${name}"

./bench_"${name}" "$num_iters" "$input"
}
Expand All @@ -45,4 +45,4 @@ bench_program "factorial" 5000000 20
bench_program "fib" 5000 20

# Cleanup
rm ./*.so
#rm ./*.so

0 comments on commit a51d5d5

Please sign in to comment.