1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-25 00:12:54 +08:00
osu-lazer/osu.Game.Benchmarks/BenchmarkMod.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
806 B
C#
Raw Normal View History

2021-08-18 14:18:03 +08:00
// 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 System;
using BenchmarkDotNet.Attributes;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Benchmarks
{
public class BenchmarkMod : BenchmarkTest
{
2022-07-09 21:07:47 +08:00
private OsuModDoubleTime mod = null!;
2021-08-18 14:18:03 +08:00
[Params(1, 10, 100)]
public int Times { get; set; }
public override void SetUp()
2021-08-18 14:18:03 +08:00
{
base.SetUp();
2021-08-18 14:18:03 +08:00
mod = new OsuModDoubleTime();
}
[Benchmark]
public int ModHashCode()
{
var hashCode = new HashCode();
for (int i = 0; i < Times; i++)
hashCode.Add(mod);
return hashCode.ToHashCode();
}
}
}