mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
36 lines
935 B
C#
36 lines
935 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 System.Collections.Generic;
|
|
using BenchmarkDotNet.Attributes;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
namespace osu.Framework.Benchmarks
|
|
{
|
|
[MemoryDiagnoser]
|
|
public partial class BenchmarkAsyncDisposal
|
|
{
|
|
private readonly List<Drawable> objects = new List<Drawable>();
|
|
|
|
[GlobalSetup]
|
|
[OneTimeSetUp]
|
|
public virtual void SetUp()
|
|
{
|
|
objects.Clear();
|
|
for (int i = 0; i < 10000; i++)
|
|
objects.Add(new Box());
|
|
}
|
|
|
|
[Test]
|
|
[Benchmark]
|
|
public void Run()
|
|
{
|
|
objects.ForEach(AsyncDisposalQueue.Enqueue);
|
|
AsyncDisposalQueue.WaitForEmpty();
|
|
}
|
|
}
|
|
}
|