mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09:00
Add benchmark coverage of mod retrieval
This commit is contained in:
parent
41a2e6eeeb
commit
efaf07dbc8
42
osu.Game.Benchmarks/BenchmarkRuleset.cs
Normal file
42
osu.Game.Benchmarks/BenchmarkRuleset.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// 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.Game.Online.API;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
|
||||||
|
namespace osu.Game.Benchmarks
|
||||||
|
{
|
||||||
|
public class BenchmarkRuleset : BenchmarkTest
|
||||||
|
{
|
||||||
|
private OsuRuleset ruleset;
|
||||||
|
private APIMod apiModDoubleTime;
|
||||||
|
private APIMod apiModDifficultyAdjust;
|
||||||
|
|
||||||
|
public override void SetUp()
|
||||||
|
{
|
||||||
|
base.SetUp();
|
||||||
|
ruleset = new OsuRuleset();
|
||||||
|
apiModDoubleTime = new APIMod { Acronym = "DT" };
|
||||||
|
apiModDifficultyAdjust = new APIMod { Acronym = "DA" };
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void BenchmarkToModDoubleTime()
|
||||||
|
{
|
||||||
|
apiModDoubleTime.ToMod(ruleset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void BenchmarkToModDifficultyAdjust()
|
||||||
|
{
|
||||||
|
apiModDifficultyAdjust.ToMod(ruleset);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void BenchmarkGetAllMods()
|
||||||
|
{
|
||||||
|
ruleset.GetAllMods();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user