sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Investigate running benchmark in CI and post results

Open bruno-garcia opened this issue 3 years ago • 4 comments

To investigate: https://github.com/marketplace/actions/continuous-benchmark-net

bruno-garcia avatar Mar 04 '21 19:03 bruno-garcia

Looks really shaky. It compares benchmarks against previous (cached) results instead of running another benchmark on HEAD/parent commit. The action expects 1 output file, but Benchmark.NET produces several (one per each benchmark). The PR/fork does not suggest a way to deal with this, the included sample only has one benchmark.

I also looked for other ready solutions to help us with this, but it seems that there's nothing good for .NET. I think we're better off making our own action.

It would work by doing the following:

Job 1:

  1. Checkout repo at current commit
  2. Run benchmarks with JSON formatter
  3. Upload benchmark results as an artifact

Job 2 (parallel with 1):

  1. Checkout repo at base commit
  2. Run benchmarks with JSON formatter
  3. Upload benchmark results as an artifact

Job 3 (after 1 and 2):

  1. Retrieve artifacts from Job 1
  2. Retrieve artifacts from Job 2
  3. Parse the JSON results, compare benchmark performance
  4. If the mean goes up by 50% (or whatever), report ::error:

The heavy lifting in Job 3 can of course be done in Powershell to avoid having to create a separate action repository, but I think it will be easier to write in Javascript. One way or another, this will probably take a few days, so I wanted to confirm if it's something we want to commit to.

Tyrrrz avatar May 20 '21 00:05 Tyrrrz

It compares benchmarks against previous (cached) results instead of running another benchmark on HEAD/parent commit.

Sounds like a good idea to me though instead of having to rerun it on each PR, just relying on the previous results?

I think we're better off making our own action.

It might be the way to go but it's possibly something we'll kick further down the road as it'll involve non trivial effort on our end.

bruno-garcia avatar Jun 15 '21 03:06 bruno-garcia

Sounds like a good idea to me though instead of having to rerun it on each PR, just relying on the previous results?

It may be a good idea in theory but caching is very unreliable and you also don't get the option to have separate caches per branch. So if someone submits a PR it might cache those results and then compare incorrectly.

Tyrrrz avatar Jun 15 '21 14:06 Tyrrrz

I wasn't necessarily thinking of GItHub cache. We might rely on another service such as GCS

bruno-garcia avatar Jun 18 '21 20:06 bruno-garcia