mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
30 lines
854 B
C#
30 lines
854 B
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using BenchmarkDotNet.Attributes;
|
|
using osu.Framework.Bindables;
|
|
|
|
namespace osu.Framework.Benchmarks
|
|
{
|
|
[MemoryDiagnoser]
|
|
public class BenchmarkBindableNumber
|
|
{
|
|
private readonly BindableInt bindableNoPrecision = new BindableInt();
|
|
private readonly BindableInt bindableWithPrecision = new BindableInt { Precision = 5 };
|
|
|
|
[Benchmark]
|
|
public void SetValueNoPrecision()
|
|
{
|
|
for (int i = 0; i < 1000; i++)
|
|
bindableNoPrecision.Value = i;
|
|
}
|
|
|
|
[Benchmark]
|
|
public void SetValueWithPrecision()
|
|
{
|
|
for (int i = 0; i < 1000; i++)
|
|
bindableWithPrecision.Value = i;
|
|
}
|
|
}
|
|
}
|