updates submodule & fixes content benchmarks & sets up ci (#11851)

This commit is contained in:
Paul Ritter
2022-10-11 20:51:52 +02:00
committed by GitHub
parent 576443f12c
commit 4ef3891e9e
14 changed files with 146 additions and 12 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using Content.IntegrationTests;
using Content.Server.Maps;
using Robust.Server.Maps;
using Robust.Shared;
using Robust.Shared.Analyzers;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Benchmarks;
[Virtual]
public class MapLoadBenchmark
{
private PairTracker _pair = default!;
[GlobalSetup]
public void Setup()
{
ProgramShared.PathOffset = "../../../../";
_pair = PoolManager.GetServerClient().GetAwaiter().GetResult();
Paths = _pair.Pair.Server.ResolveDependency<IPrototypeManager>()
.EnumeratePrototypes<GameMapPrototype>().ToDictionary(x => x.ID, x => x.MapPath.ToString());
IoCManager.InitThread(_pair.Pair.Server.InstanceDependencyCollection);
}
public static IEnumerable<string> MapsSource { get; set; }
[ParamsSource(nameof(MapsSource))] public string Map;
public static Dictionary<string, string> Paths;
[Benchmark]
public void LoadMap()
{
_pair.Pair.Server.ResolveDependency<IMapLoader>().LoadMap(new MapId(10), Paths[Map]);
}
}