* Add data field for id card microwave behaviour (#28087) * Move replacement chance from ReplacementAccentComponent to ReplacementAccentPrototype (#28049) Move replacement chance to ReplacementAccentPrototype * Resolves Bible summon message being sent to all users (#28104) * Changed PopupEntity overload used to ensure message is only sent to user * Updated uid for PopupEntity call * Updating _popupSystem.PopupEntity call in AttemptSummon * Random book story generator refactor (#28082) * Randomized book overhaul * Fix prototype names * Improved setting paper content * Praise Ratvar * Fix activatable UI popup message spam (#28123) Fixed activatable UI popup message spam * Modify battery assert to avoid floating point errors (#28007) * Update component query benchmarks (#27967) * Add more component query benchmarks. * Rename benchmark * Use non-generic `TryComp()` for metadata & transform (#28133) * sleeper agent appear later into the round and only once (#28160) --------- Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: double_b <40827162+benjamin-burges@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using System.Threading.Tasks;
|
|
using BenchmarkDotNet.Attributes;
|
|
using Content.IntegrationTests;
|
|
using Content.IntegrationTests.Pair;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Shared.Roles;
|
|
using Robust.Shared;
|
|
using Robust.Shared.Analyzers;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Benchmarks;
|
|
|
|
/// <summary>
|
|
/// This benchmarks spawns several humans, gives them captain equipment and then deletes them.
|
|
/// This measures performance for spawning, deletion, containers, and inventory code.
|
|
/// </summary>
|
|
[Virtual, MemoryDiagnoser]
|
|
public class SpawnEquipDeleteBenchmark
|
|
{
|
|
private TestPair _pair = default!;
|
|
private StationSpawningSystem _spawnSys = default!;
|
|
private const string Mob = "MobHuman";
|
|
private StartingGearPrototype _gear = default!;
|
|
private EntityUid _entity;
|
|
private EntityCoordinates _coords;
|
|
|
|
[Params(1, 4, 16, 64)]
|
|
public int N;
|
|
|
|
[GlobalSetup]
|
|
public async Task SetupAsync()
|
|
{
|
|
ProgramShared.PathOffset = "../../../../";
|
|
PoolManager.Startup();
|
|
_pair = await PoolManager.GetServerClient();
|
|
var server = _pair.Server;
|
|
|
|
var mapData = await _pair.CreateTestMap();
|
|
_coords = mapData.GridCoords;
|
|
_spawnSys = server.System<StationSpawningSystem>();
|
|
_gear = server.ProtoMan.Index<StartingGearPrototype>("CaptainGear");
|
|
}
|
|
|
|
[GlobalCleanup]
|
|
public async Task Cleanup()
|
|
{
|
|
await _pair.DisposeAsync();
|
|
PoolManager.Shutdown();
|
|
}
|
|
|
|
[Benchmark]
|
|
public async Task SpawnDeletePlayer()
|
|
{
|
|
await _pair.Server.WaitPost(() =>
|
|
{
|
|
var server = _pair.Server;
|
|
for (var i = 0; i < N; i++)
|
|
{
|
|
_entity = server.EntMan.SpawnAttachedTo(Mob, _coords);
|
|
_spawnSys.EquipStartingGear(_entity, _gear);
|
|
server.EntMan.DeleteEntity(_entity);
|
|
}
|
|
});
|
|
}
|
|
}
|