Skip to content

Commit f62f6fb

Browse files
committed
Fix base number calculation
1 parent 41366ad commit f62f6fb

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ The v0.7.0 and v0.8.0 benchmarks on skylake were collected by running:
5858

5959
```
6060
host=<skylake/skylake-x/ampere/rome/etc.>
61-
./run_benchmark_official.sh $host v0.8.0 v0.8.0 "clang10 clang11 gcc10.2" "production release native westmere fallback debug" ".*"
62-
./run_benchmark_official.sh $host v0.7.0 v0.7.0 "clang10 clang11 gcc10.2" "production release native westmere fallback debug" ".*"
61+
./run_benchmark_official.sh $host v0.8.0 v0.8.0 "clang10 clang11 gcc10.2" "release development native westmere fallback debug" ".*"
62+
./run_benchmark_official.sh $host v0.7.0 v0.7.0 "clang10 clang11 gcc10.2" "release development native westmere fallback debug" ".*"
6363
./run_benchmark_official.sh $host v0.7.0 "v0.8.0~1 v0.8.0~5 v0.8.0~10 v0.8.0~15 v0.8.0~20 v0.8.0~25 v0.8.0~30 v0.8.0~35" "clang11 gcc10.2" "production"
6464
```
6565

graph_benchmarks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def match_any(regexes, value):
8585
benchmarks = pd.concat(runs)
8686
benchmarks = benchmarks[benchmarks['benchmark_name'].apply(lambda benchmark_name: match_any(args.benchmarks, benchmark_name))]
8787
benchmarks = benchmarks[benchmarks['json_implementation'].apply(lambda json_implementation: match_any(args.implementations, json_implementation))]
88-
print(f"Generating graphs for {benchmarks.count().count()} matching benchmarks ...")
89-
for path,fig in google_benchmark_graph.graph_grouped_benchmarks(benchmarks):
88+
print(f"Generating graphs for {benchmarks.count()} matching benchmarks ...")
89+
for path,fig in google_benchmark_graph.graph_grouped_benchmarks(benchmarks, "best_instructions", "Instructions", 1):
9090
png_path = os.path.splitext(path)[0]+'.png'
9191
print(png_path)
9292
fig.write_image(png_path)

run_benchmark_official.sh

+17-10
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,25 @@ function bench_results() {
8484
#
8585
base_dir=$SCRIPT_DIR/$base_version
8686

87-
# Figure out # of commits past version
88-
cd $SCRIPT_DIR/simdjson
89-
fork_commit=$(git merge-base $base_version $commit)
90-
commits_past_version=$(git rev-list --count --first-parent $base_version...$fork_commit)
91-
if [ "$commits_past_version" -ne "0" ]; then
92-
base_dir="$base_dir/$commits_past_version"
87+
# Error if commit is not a child of the base version
88+
if ! git merge-base --is-ancestor $base_version $commit; then
89+
echo "Commit $commit is not derived from $base_version!"
90+
exit 1;
9391
fi
9492

95-
# Figure out if commit is unmerged
96-
actual_commit=$(git rev-list -n 1 $commit)
97-
if [ "$fork_commit" != "$actual_commit" ]; then
98-
base_dir="$base_dir/$actual_commit"
93+
cd $SCRIPT_DIR/simdjson
94+
if git merge-base --is-ancestor $commit master; then
95+
# If it's *past* the base version, use the number of commits past the base version for the directory.
96+
commits_past_version=$(git rev-list --count --first-parent $base_version...$commit)
97+
if [ "$commits_past_version" -ne "0" ]; then
98+
echo "Commit $commit is $commits_past_version commits past $base_version."
99+
base_dir="$base_dir/$commits_past_version"
100+
fi
101+
else
102+
# If it's not on master, it's a branch ... use the commit id.
103+
commit_sha=$(git rev-list -n 1 $commit)
104+
echo "$commit ($commit_sha) is not on master. Setting base_dir to commit id $commit_sha..."
105+
base_dir="$base_dir/$commit_sha"
99106
fi
100107

101108
mkdir -p $base_dir

0 commit comments

Comments
 (0)