Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

ci(circleci): add benchmark comparisons #147

Merged
merged 3 commits into from Jul 3, 2019
Merged

Conversation

hannahhoward
Copy link
Contributor

@hannahhoward hannahhoward commented Jun 21, 2019

Goals

Add Benchmarking to CI in Bitswap!

Implementation

This adds a new job to Bitswap's Travis Config that runs benchmarks across both master and the current branch based on ipfs/kubo#6446 but adopted for Travis instead of CircleCI (various script config changes, etc)

Also, required making a few patches to benchmarks so they aren't failing and also seeded on a similar random seed. These were merged in master so this PR could complete CI w/o failing. (#dontHateMe)

For Discussion

I can't get these to predictably and reliably pass without setting the threshold lower than <5% --- I've got it currently set at <25%, which is a bummer in that it's imprecise but still protects against order of magnitude regressions ala what happened with 0.4.21.

Also, this does mean CI takes somewhat longer, about 6 minutes.

@hannahhoward hannahhoward force-pushed the feat/benchmark-ci branch 22 times, most recently from 4d3ce76 to 6dca0e9 Compare June 23, 2019 07:54
@hannahhoward hannahhoward force-pushed the feat/benchmark-ci branch 2 times, most recently from 2a6239e to c0f6e39 Compare June 30, 2019 19:36
Run benchmarks before and after, compare results
@hannahhoward hannahhoward force-pushed the feat/benchmark-ci branch 2 times, most recently from b8cf00b to 4238f53 Compare July 2, 2019 23:49
@hannahhoward hannahhoward requested a review from Kubuxu July 3, 2019 00:22
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benchmarks look good but I'd like to avoid duplicating the CI scripts. And yeah, 25% sucks but it's CI.

Thanks for putting this together!

bin/build.sh Outdated
done
}

build_all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this file.

fi
( cd "$dir"; go build -buildmode=$buildmode -o /dev/null "$pkg")
done
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably skip all of this logic and just rely on the standard test scripts.

display_and_run BENCHMARK_SEED="$$" ./bin/benchmark-to-file.sh benchmark-after.txt after
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
display_and_run ./bin/diff-benchmarks.sh benchmark-before.txt benchmark-after.txt
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have \n at the ends of scripts. This is standard on unix systems.

@Kubuxu
Copy link
Member

Kubuxu commented Jul 3, 2019

shellcheck pointed these out:


In benchmark-to-file.sh line 2:
output="$1"
^----^ SC2034: output appears unused. Verify use (or export if used externally).


In benchmark-to-file.sh line 3:
branch="$2"
^----^ SC2034: branch appears unused. Verify use (or export if used externally).


In diff-benchmarks.sh line 3:
before="$1"
^----^ SC2034: before appears unused. Verify use (or export if used externally).


In diff-benchmarks.sh line 4:
after="$2"
^---^ SC2034: after appears unused. Verify use (or export if used externally).


In run-benchmarks.sh line 6:
	eval $(printf '%q ' "$@")
             ^------------------^ SC2046: Quote this to prevent word splitting.

For more information:
  https://www.shellcheck.net/wiki/SC2034 -- after appears unused. Verify use ...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...

Remove unused code, follow conventions
@hannahhoward
Copy link
Contributor Author

@Stebalien + @Kubuxu incorporated suggestions though I wasn't sure what to do with "The benchmarks look good but I'd like to avoid duplicating the CI scripts." Anyway let me know if I can merge.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ❤️

The "duplicate code" comment was referring to the code duplicated from https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh

@Stebalien Stebalien merged commit cfc5c2f into master Jul 3, 2019
@Stebalien Stebalien deleted the feat/benchmark-ci branch July 3, 2019 18:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants