-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add performance-benchmark skill for ad hoc benchmarking with EgorBot #123319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a Copilot skill that enables developers to run ad hoc performance benchmarks on pull requests using EgorBot. The skill teaches Copilot how to write BenchmarkDotNet benchmarks following best practices and format PR comments that trigger EgorBot with appropriate flags for profiling, disassembly, and commit comparison.
Changes:
- New skill documentation file that provides comprehensive guidance on writing BenchmarkDotNet benchmarks
- EgorBot integration instructions including target platform flags, profiling options, and environment variable configuration
- Multiple example benchmarks and command invocations covering common scenarios
|
@copilot, please remove this if block and then measure the performance impact of the change using the benchmarking skill
|
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Removed the @EgorBot -intel -arm using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[MemoryDiagnoser]
public class Bench
{
private List<int> _list = default!;
private int[] _array = default!;
private HashSet<int> _hashSet = default!;
[Params(0, 1, 100)]
public int Count { get; set; }
[GlobalSetup]
public void Setup()
{
_list = Enumerable.Range(0, Count).ToList();
_array = Enumerable.Range(0, Count).ToArray();
_hashSet = Enumerable.Range(0, Count).ToHashSet();
}
[Benchmark]
public bool AnyList() => _list.Any();
[Benchmark]
public bool AnyArray() => _array.Any();
[Benchmark]
public bool AnyHashSet() => _hashSet.Any();
} |
|
@EgorBo, what needs to be different for the bot to kick in? |
|
Also, @EgorBo, could we modify the bot to post back to the original comment and include the username when it's done its work? If that's copilot, it should then in theory enable an end to end workflow where copilot invokes the bot and the bot then invokes copilot, assuming the bot has permissions that copilot respects. |
adamsitnik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please address my feedback
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
At risk of putting words in Egor's mouth, our bots have allow-lists for who can trigger such commands. I imagine the logic there would have to change to look at who triggered the Copilot PR instead of just the comment author (or just that it is a copilot PR since that already implies a team member).
The bots are currently effectively a random account with no non-public permissions to these repos. Just throwing the idea out there, could we expose this as an MCP server / API instead of going through comments? |
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
|
@copilot, please remove this if block and then benchmark the change:
|
…rking Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Removed the @EgorBot -x64 -arm using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[MemoryDiagnoser]
public class Bench
{
private List<int> _list = default!;
private int[] _array = default!;
private HashSet<int> _hashSet = default!;
[Params(0, 1, 100)]
public int Count { get; set; }
[GlobalSetup]
public void Setup()
{
_list = Enumerable.Range(0, Count).ToList();
_array = Enumerable.Range(0, Count).ToArray();
_hashSet = Enumerable.Range(0, Count).ToHashSet();
}
[Benchmark]
public bool AnyList() => _list.Any();
[Benchmark]
public bool AnyArray() => _array.Any();
[Benchmark]
public bool AnyHashSet() => _hashSet.Any();
} |
|
@EgorBo, is the bot working correctly? I was expecting the above comment to be picked up. |
hm.. it was supposed to be, just checked via EgorBot/runtime-utils#599 Let me see the logs, I wonder if certain github APIs just don't return comments left by bots |
Removed the @EgorBot -x64 -arm using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[MemoryDiagnoser]
public class Bench
{
private List<int> _list = default!;
private int[] _array = default!;
private HashSet<int> _hashSet = default!;
[Params(0, 1, 100)]
public int Count { get; set; }
[GlobalSetup]
public void Setup()
{
_list = Enumerable.Range(0, Count).ToList();
_array = Enumerable.Range(0, Count).ToArray();
_hashSet = Enumerable.Range(0, Count).ToHashSet();
}
[Benchmark]
public bool AnyList() => _list.Any();
[Benchmark]
public bool AnyArray() => _array.Any();
[Benchmark]
public bool AnyHashSet() => _hashSet.Any();
} |
|
@copilot please try running the benchmark again |
@EgorBot -x64 -arm using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[MemoryDiagnoser]
public class Bench
{
private List<int> _list = default!;
private int[] _array = default!;
private HashSet<int> _hashSet = default!;
[Params(0, 1, 100)]
public int Count { get; set; }
[GlobalSetup]
public void Setup()
{
_list = Enumerable.Range(0, Count).ToList();
_array = Enumerable.Range(0, Count).ToArray();
_hashSet = Enumerable.Range(0, Count).ToHashSet();
}
[Benchmark]
public bool AnyList() => _list.Any();
[Benchmark]
public bool AnyArray() => _array.Any();
[Benchmark]
public bool AnyHashSet() => _hashSet.Any();
} |
|
Sweet. @copilot please revert the LINQ commit. |
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
|
/ba-g markdown only |
Description
Adds a Copilot skill that enables ad hoc performance benchmarks to be run on PRs using EgorBot.
The skill teaches Copilot to:
Example invocation generated by the skill: