Files
tbd-station-14/Content.Benchmarks/MapLoadBenchmark.cs
Spessmann a07df05858 New Highpop map: Convex recreational complex (#33346)
* start ig

* command work +AI

* finished bridge, added signs to departments

* engi partly done

* finish engi + atmos except for cams

* added med yippie

* carGODO

* nerd department finished

* se(x)c finish

* courtroom + service power

* man im tweaking out

* service propa done

* hallways

* added cams everywhere and named all the doors :pain:

* arrivals maints + exterior catwalk

* more maints

* voxob

* draft done

* holopadpilled + gaspipesensor based

* added convex name everywhere it needed to be

* nvm i guess we dont do oxford comma

* redid ALL THE HGOLOPADS FAAAAAAAAAAAAAAAAAAAAA

* Fix conflicts?

* ok let me try something

* this works right?

* atmos updated + jani lights

* uniform hallway tiles +roundstart TEG

* fixed some hidden atmos stuff

* Update map_attributions.txt

* :finnadie: no map review ...

* the fog is coming

* maints theater redone

* light dirt and the murder of most trims

* 💔

* decal based and tileoverlay pilled

* updated arrivals/library

* bungus

* yvgh

* 6 hours later...

* finished for real?
2025-01-29 19:44:45 -07:00

79 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Content.IntegrationTests;
using Content.IntegrationTests.Pair;
using Content.Server.Maps;
using Robust.Server.GameObjects;
using Robust.Shared;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Benchmarks;
[Virtual]
public class MapLoadBenchmark
{
private TestPair _pair = default!;
private MapLoaderSystem _mapLoader = default!;
private IMapManager _mapManager = default!;
[GlobalSetup]
public void Setup()
{
ProgramShared.PathOffset = "../../../../";
PoolManager.Startup();
_pair = PoolManager.GetServerClient().GetAwaiter().GetResult();
var server = _pair.Server;
Paths = server.ResolveDependency<IPrototypeManager>()
.EnumeratePrototypes<GameMapPrototype>()
.ToDictionary(x => x.ID, x => x.MapPath.ToString());
_mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
_mapManager = server.ResolveDependency<IMapManager>();
}
[GlobalCleanup]
public async Task Cleanup()
{
await _pair.DisposeAsync();
PoolManager.Shutdown();
}
public static readonly string[] MapsSource = { "Empty", "Satlern", "Box", "Bagel", "Dev", "CentComm", "Core", "TestTeg", "Packed", "Omega", "Reach", "Meta", "Marathon", "MeteorArena", "Fland", "Oasis", "Cog", "Convex"};
[ParamsSource(nameof(MapsSource))]
public string Map;
public Dictionary<string, string> Paths;
[Benchmark]
public async Task LoadMap()
{
var mapPath = Paths[Map];
var server = _pair.Server;
await server.WaitPost(() =>
{
var success = _mapLoader.TryLoad(new MapId(10), mapPath, out _);
if (!success)
throw new Exception("Map load failed");
});
}
[IterationCleanup]
public void IterationCleanup()
{
var server = _pair.Server;
server.WaitPost(() =>
{
_mapManager.DeleteMap(new MapId(10));
}).Wait();
}
}