-
Notifications
You must be signed in to change notification settings - Fork 1
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
EgorBot for EgorBo in #107304 #78
Comments
Benchmark results on
|
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
TrailingZeroCount_ulong | Before | 279.5 ns | 0.10 ns | 1.00 |
TrailingZeroCount_ulong | After | 278.0 ns | 0.22 ns | 0.99 |
Flame graphs: Main vs PR 🔥
Hot asm: Main vs PR
Hot functions: Main vs PR
Counters: Main vs PR
For clean perf
results, make sure you have just one [Benchmark]
in your app.
@EgorBot -awsamd -commit 72f9ee0d26c23b3c58ec5af8aeea316095761646 vs 767e4165641583c73918168a920a10513000572c -profiler --envvars DOTNET_JitDisasm:TrailingZeroCount_ulong using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Numerics;
using System.Runtime.CompilerServices;
public class Perf_BitOperations
{
static T[] Array<T>(int count, int? seed = null)
{
var result = new T[count];
var random = new Random(42);
if (typeof(T) == typeof(byte) || typeof(T) == typeof(sbyte))
random.NextBytes(Unsafe.As<byte[]>(result));
else
for (int i = 0; i < result.Length; i++)
result[i] = GenerateValue<T>(random);
return result;
}
static T GenerateValue<T>(Random random)
{
if (typeof(T) == typeof(uint))
return (T)(object)(uint)random.Next();
if (typeof(T) == typeof(ulong))
return (T)(object)(ulong)random.Next();
throw new NotImplementedException();
}
static uint[] input_uint = Array<uint>(1000);
static ulong[] input_ulong = Array<ulong>(1000);
[Benchmark]
public int TrailingZeroCount_ulong()
{
int sum = 0;
ulong[] input = input_ulong;
for (int i = 0; i < input.Length; i++)
{
sum += BitOperations.TrailingZeroCount(input[i]);
}
return sum;
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Processing dotnet/runtime#107304 (comment) command:
Command
-awsamd -commit 72f9ee0d26c23b3c58ec5af8aeea316095761646 vs 767e4165641583c73918168a920a10513000572c -profiler --envvars DOTNET_JitDisasm:TrailingZeroCount_ulong
(EgorBot will reply in this issue)
The text was updated successfully, but these errors were encountered: