Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Merge branch 'branchy' of https://github.com/leonardo-dabepis/Delta-v
Browse files Browse the repository at this point in the history
…into branchy
  • Loading branch information
leonardo-dabepis committed Jul 21, 2023
2 parents b0b1b5c + 991db1e commit 14f2084
Show file tree
Hide file tree
Showing 3,121 changed files with 70,685 additions and 56,221 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake
10 changes: 4 additions & 6 deletions Content.Benchmarks/DeviceNetworkingBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Content.IntegrationTests;
Expand All @@ -9,7 +8,6 @@
using Robust.Shared;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;

namespace Content.Benchmarks;
Expand All @@ -23,8 +21,8 @@ public class DeviceNetworkingBenchmark
private DeviceNetworkSystem _deviceNetworkSystem = default!;
private EntityUid _sourceEntity;
private EntityUid _sourceWirelessEntity;
private List<EntityUid> _targetEntities = new();
private List<EntityUid> _targetWirelessEntities = new();
private readonly List<EntityUid> _targetEntities = new();
private readonly List<EntityUid> _targetWirelessEntities = new();


private NetworkPayload _payload = default!;
Expand Down Expand Up @@ -58,7 +56,7 @@ public class DeviceNetworkingBenchmark
public async Task SetupAsync()
{
ProgramShared.PathOffset = "../../../../";
_pair = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
_pair = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = Prototypes });
var server = _pair.Pair.Server;

await server.WaitPost(() =>
Expand Down
8 changes: 4 additions & 4 deletions Content.Benchmarks/DynamicTreeBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Content.Benchmarks
[Virtual]
public class DynamicTreeBenchmark
{
private static readonly Box2[] _aabbs1 =
private static readonly Box2[] Aabbs1 =
{
((Box2) default).Enlarged(1), //2x2 square
((Box2) default).Enlarged(2), //4x4 square
Expand Down Expand Up @@ -39,11 +39,11 @@ public class DynamicTreeBenchmark
public void Setup()
{
_b2Tree = new B2DynamicTree<int>();
_tree = new DynamicTree<int>((in int value) => _aabbs1[value], capacity: 16);
_tree = new DynamicTree<int>((in int value) => Aabbs1[value], capacity: 16);

for (var i = 0; i < _aabbs1.Length; i++)
for (var i = 0; i < Aabbs1.Length; i++)
{
var aabb = _aabbs1[i];
var aabb = Aabbs1[i];
_b2Tree.CreateProxy(aabb, i);
_tree.Add(i);
}
Expand Down
6 changes: 2 additions & 4 deletions Content.Benchmarks/EntityFetchBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ private abstract class EntityStorage<TEntity, TEntityUid> : IEntityStorage<TEnti
public TEntity GetEntity(TEntityUid entityUid)
{
if (!TryGetEntity(entityUid, out var entity))
{
throw new ArgumentException();
}
throw new ArgumentException($"Failed to get entity {entityUid} from storage.");

return entity;
}
Expand All @@ -200,7 +198,7 @@ public TEntity GetEntity(TEntityUid entityUid)
private sealed class GenEntityStorage : EntityStorage<GenEntity, GenEntityUid>
{
private (int generation, GenEntity entity)[] _entities = new (int, GenEntity)[1];
private readonly List<int> _availableSlots = new() {0};
private readonly List<int> _availableSlots = new() { 0 };

public override bool TryGetEntity(GenEntityUid entityUid, out GenEntity entity)
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Benchmarks/EntityManagerGetAllComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Setup()
var componentFactory = new Mock<IComponentFactory>();
componentFactory.Setup(p => p.GetComponent<DummyComponent>()).Returns(new DummyComponent());
componentFactory.Setup(p => p.GetRegistration(It.IsAny<DummyComponent>())).Returns(dummyReg);
componentFactory.Setup(p => p.GetAllRefTypes()).Returns(new[] {CompIdx.Index<DummyComponent>()});
componentFactory.Setup(p => p.GetAllRefTypes()).Returns(new[] { CompIdx.Index<DummyComponent>() });

IoCManager.RegisterInstance<IComponentFactory>(componentFactory.Object);

Expand Down
5 changes: 3 additions & 2 deletions Content.Benchmarks/MapLoadBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ public async Task Cleanup()

public static IEnumerable<string> MapsSource { get; set; }

[ParamsSource(nameof(MapsSource))] public string Map;
[ParamsSource(nameof(MapsSource))]
public string Map;

public static Dictionary<string, string> Paths;
public Dictionary<string, string> Paths;

[Benchmark]
public async Task LoadMap()
Expand Down
8 changes: 4 additions & 4 deletions Content.Benchmarks/NetSerializerIntBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class NetSerializerIntBenchmark
{
private MemoryStream _writeStream;
private MemoryStream _readStream;
private ushort _x16 = 5;
private uint _x32 = 5;
private ulong _x64 = 5;
private readonly ushort _x16 = 5;
private readonly uint _x32 = 5;
private readonly ulong _x64 = 5;
private ushort _read16;
private uint _read32;
private ulong _read64;
Expand All @@ -24,7 +24,7 @@ public void Setup()
{
_writeStream = new MemoryStream(64);
_readStream = new MemoryStream();
_readStream.Write(new byte[]{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8});
_readStream.Write(new byte[] { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 });
}

[Benchmark]
Expand Down
Loading

0 comments on commit 14f2084

Please sign in to comment.