-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Test: simplify gc memmove #109014
base: main
Are you sure you want to change the base?
Test: simplify gc memmove #109014
Conversation
@EgorBot -intel -arm64 -profiler -nonativepgo using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[GcServer(true)]
public class Bench
{
static object[] Src0 = Enumerable.Range(0, 2).Select(i => (object)i).ToArray();
static object[] Src1 = Enumerable.Range(0, 10).Select(i => (object)i).ToArray();
static object[] Src2 = Enumerable.Range(0, 128).Select(i => (object)i).ToArray();
static object[] Dst = new object[128];
[Benchmark]public void CopyObjects2() => Src0.AsSpan().CopyTo(Dst);
[Benchmark]public void CopyObjects10() => Src1.AsSpan().CopyTo(Dst);
[Benchmark]public void CopyObjects128() => Src2.AsSpan().CopyTo(Dst);
} |
Is auto-vectorization by C++ compiler expected to kick in? |
I am just curious about the impact of the logic we have here.
UPD: Results suggest the plain loop is faster? EgorBot/runtime-utils#123 (not sure about windows/msvc) |
How about the numbers at |
@EgorBot -arm64 -profiler -nonativepgo -perf_events ld_align_lat using BenchmarkDotNet.Attributes;
public class Bench
{
static object[] Src = Enumerable.Range(0, 10).Select(i => (object)i).ToArray();
static object[] Dst = new object[128];
[Benchmark]public void CopyObjects10() => Src.AsSpan().CopyTo(Dst);
} |
do you mean AVX numbers? I guess the atomicity concern still stands |
@EgorBot -intel -arm64 -profiler -nonativepgo using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[GcServer(true)]
public class Bench
{
static object[] Src0 = Enumerable.Range(0, 2).Select(i => (object)i).ToArray();
static object[] Src1 = Enumerable.Range(0, 10).Select(i => (object)i).ToArray();
static object[] Src2 = Enumerable.Range(0, 128).Select(i => (object)i).ToArray();
static object[] Dst = new object[128];
[Benchmark]public void CopyObjects2() => Src0.AsSpan().CopyTo(Dst);
[Benchmark]public void CopyObjects10() => Src1.AsSpan().CopyTo(Dst);
[Benchmark]public void CopyObjects128() => Src2.AsSpan().CopyTo(Dst);
} |
With Main:
PR:
|
No description provided.