A game framework written with osu! in mind.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add benchmark project

authored by

Dean Herbert and committed by
smoogipoo
5eda0023 afc942b0

+136 -1
+2 -1
osu-framework.Desktop.slnf
··· 6 6 "SampleGame\\SampleGame.csproj", 7 7 "osu.Framework.NativeLibs\\osu.Framework.NativeLibs.csproj", 8 8 "osu.Framework.Tests\\osu.Framework.Tests.csproj", 9 - "osu.Framework\\osu.Framework.csproj" 9 + "osu.Framework\\osu.Framework.csproj", 10 + "osu.Framework.Benchmarks\\osu.Framework.Benchmarks.csproj" 10 11 ] 11 12 } 12 13 }
+14
osu-framework.sln
··· 36 36 osu.Framework.iOS.props = osu.Framework.iOS.props 37 37 EndProjectSection 38 38 EndProject 39 + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.Benchmarks", "osu.Framework.Benchmarks\osu.Framework.Benchmarks.csproj", "{F294C804-8AE2-4020-841A-AF0D97FBE80C}" 40 + EndProject 39 41 Global 40 42 GlobalSection(SolutionConfigurationPlatforms) = preSolution 41 43 Debug|Any CPU = Debug|Any CPU ··· 170 172 {320089C6-A141-4D3E-BD5F-C4A6CE9E567B}.Release|Any CPU.Deploy.0 = Release|Any CPU 171 173 {320089C6-A141-4D3E-BD5F-C4A6CE9E567B}.Release|iPhone.ActiveCfg = Release|Any CPU 172 174 {320089C6-A141-4D3E-BD5F-C4A6CE9E567B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 175 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 176 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Debug|Any CPU.Build.0 = Debug|Any CPU 177 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Debug|iPhone.ActiveCfg = Debug|Any CPU 178 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Debug|iPhone.Build.0 = Debug|Any CPU 179 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 180 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 181 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Release|Any CPU.ActiveCfg = Release|Any CPU 182 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Release|Any CPU.Build.0 = Release|Any CPU 183 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Release|iPhone.ActiveCfg = Release|Any CPU 184 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Release|iPhone.Build.0 = Release|Any CPU 185 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 186 + {F294C804-8AE2-4020-841A-AF0D97FBE80C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 173 187 EndGlobalSection 174 188 GlobalSection(SolutionProperties) = preSolution 175 189 HideSolutionNode = FALSE
+70
osu.Framework.Benchmarks/BenchmarkFontLoading.cs
··· 1 + using System; 2 + using System.Diagnostics; 3 + using System.Reflection; 4 + using BenchmarkDotNet.Attributes; 5 + using osu.Framework.Graphics.Sprites; 6 + using osu.Framework.IO.Stores; 7 + using osu.Framework.Tests; 8 + using SixLabors.Memory; 9 + 10 + namespace osu.Framework.Benchmarks 11 + { 12 + public class BenchmarkFontLoading : BenchmarkTest 13 + { 14 + private static NamespacedResourceStore<byte[]> baseResources; 15 + 16 + public override void SetUp() 17 + { 18 + baseResources = new NamespacedResourceStore<byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"); 19 + } 20 + 21 + private static TemporaryNativeStorage sharedTemp; 22 + 23 + private const string font_name = @"Fonts/FontAwesome5/FontAwesome-Solid"; 24 + 25 + [Benchmark] 26 + public void BenchmarkRawCachingReuse() 27 + { 28 + sharedTemp ??= new TemporaryNativeStorage("fontstore-test" + Guid.NewGuid(), createIfEmpty: true); 29 + 30 + using (var store = new RawCachingGlyphStore(baseResources, font_name) { CacheStorage = sharedTemp }) 31 + runFor(store); 32 + } 33 + 34 + [Benchmark] 35 + public void BenchmarkRawCaching() 36 + { 37 + using (var temp = new TemporaryNativeStorage("fontstore-test" + Guid.NewGuid(), createIfEmpty: true)) 38 + using (var store = new RawCachingGlyphStore(baseResources, font_name) { CacheStorage = temp }) 39 + runFor(store); 40 + } 41 + 42 + [Benchmark] 43 + public void BenchmarkSimple() 44 + { 45 + using (var store = new GlyphStore(baseResources, font_name)) 46 + runFor(store); 47 + } 48 + 49 + [Benchmark] 50 + public void BenchmarkTimedExpiry() 51 + { 52 + SixLabors.ImageSharp.Configuration.Default.MemoryAllocator = ArrayPoolMemoryAllocator.CreateWithMinimalPooling(); 53 + 54 + using (var store = new TimedExpiryGlyphStore(baseResources, font_name)) 55 + runFor(store); 56 + } 57 + 58 + private void runFor(GlyphStore store) 59 + { 60 + store.LoadFontAsync().Wait(); 61 + 62 + foreach (var p in typeof(FontAwesome.Solid).GetProperties(BindingFlags.Public | BindingFlags.Static)) 63 + { 64 + var icon = (IconUsage)p.GetValue(null); 65 + using (var upload = store.Get(icon.Icon.ToString())) 66 + Trace.Assert(upload.Data != null); 67 + } 68 + } 69 + } 70 + }
+29
osu.Framework.Benchmarks/BenchmarkTest.cs
··· 1 + // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2 + // See the LICENCE file in the repository root for full licence text. 3 + 4 + using BenchmarkDotNet.Attributes; 5 + using BenchmarkDotNet.Configs; 6 + using BenchmarkDotNet.Running; 7 + using NUnit.Framework; 8 + 9 + namespace osu.Framework.Benchmarks 10 + { 11 + [TestFixture] 12 + [MemoryDiagnoser] 13 + public abstract class BenchmarkTest 14 + { 15 + [GlobalSetup] 16 + [OneTimeSetUp] 17 + public virtual void SetUp() 18 + { 19 + } 20 + 21 + [Test] 22 + public void RunBenchmark() 23 + { 24 + var config = DefaultConfig.Instance.With(ConfigOptions.DisableOptimizationsValidator); 25 + 26 + BenchmarkRunner.Run(GetType(), config); 27 + } 28 + } 29 + }
+21
osu.Framework.Benchmarks/osu.Framework.Benchmarks.csproj
··· 1 + <Project Sdk="Microsoft.NET.Sdk"> 2 + 3 + <PropertyGroup> 4 + <TargetFramework>netcoreapp3.0</TargetFramework> 5 + <Optimize>true</Optimize> 6 + <IsPackable>false</IsPackable> 7 + </PropertyGroup> 8 + 9 + <ItemGroup> 10 + <PackageReference Include="BenchmarkDotNet" Version="0.12.0" /> 11 + <PackageReference Include="nunit" Version="3.12.0" /> 12 + <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> 13 + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> 14 + </ItemGroup> 15 + 16 + <ItemGroup> 17 + <ProjectReference Include="..\osu.Framework.Tests\osu.Framework.Tests.csproj" /> 18 + <ProjectReference Include="..\osu.Framework\osu.Framework.csproj" /> 19 + </ItemGroup> 20 + 21 + </Project>