-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Running the following benchmark
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using System.Buffers;
BenchmarkRunner.Run<Test>(args: args);
[DisassemblyDiagnoser(10)]
[ShortRunJob(RuntimeMoniker.Net80)]
[ShortRunJob(RuntimeMoniker.Net90)]
public class Test
{
private static readonly SearchValues<char> s_values = SearchValues.Create("aeiouAEIOU");
private static readonly string s_text = new('\n', 1000);
[Benchmark]
public void ContainsAny() => s_text.AsSpan().ContainsAny(s_values);
}
will print something like
| Method | Job | Runtime | Mean | Error | StdDev | Code Size |
|------------ |------------------ |--------- |---------:|---------:|---------:|----------:|
| ContainsAny | ShortRun-.NET 8.0 | .NET 8.0 | 12.89 ns | 4.731 ns | 0.259 ns | 566 B |
| ContainsAny | ShortRun-.NET 9.0 | .NET 9.0 | 11.86 ns | 0.263 ns | 0.014 ns | 55 B |
(.NET 8.0.8 and 9.0 RC 1)
where the disassembly for .NET 9 is just the top-most benchmarked method, calling into something, but the callee isn't included.
; Test.ContainsAny()
sub rsp,28
mov r8,237BFC003E8
mov rcx,[r8]
add rcx,0C
mov r8,237BFC003E0
mov r8,[r8]
add r8,8
mov edx,3E8
call qword ptr [7FFC211FE700]
nop
add rsp,28
ret
; Total bytes of code 55
I'm sure this used to work earlier in .NET 9, so it's possible a change in .NET broke this.