Skip to content

Commit

Permalink
1-C delegates and upgrade to .NET 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thygrrr committed Nov 12, 2024
1 parent c569ea7 commit 301d71d
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 32 deletions.
58 changes: 58 additions & 0 deletions fennecs.benchmarks/Conceptual/ForStructuralVsStateful.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Order;
using fennecs;
using fennecs.storage;

namespace Benchmark.Conceptual;

Expand Down Expand Up @@ -64,6 +65,63 @@ public int CountDown_with_Structural_Change()
return _stream.Count;
}

[Benchmark]
public int CountDown_NewFor_Structural_ChangeS()
{
while (_stream.Count > 0)
{
_stream.For(static (value) =>
{
value.write--;
if (value.read <= 0) value.Remove();
});
}
return _stream.Count;
}


[Benchmark]
public int CountDown_NewFor_Structural_Change()
{
while (_stream.Count > 0)
{
_stream.For((value) =>
{
value.write--;
if (value.read <= 0) value.Remove();
});
}
return _stream.Count;
}

[Benchmark]
public int CountDown_NewFor_Structural_ChangeSD()
{
while (_stream.Count > 0)
{
_stream.For(static delegate (RW<ushort> value)
{
value.write--;
if (value.read <= 0) value.Remove();
});
}
return _stream.Count;
}

[Benchmark]
public int CountDown_NewForEntity_Structural_Change()
{
while (_stream.Count > 0)
{
_stream.For((entity, value) =>
{
value.write--;
if (value.read <= 0) entity.Remove<ushort>();
});
}
return _stream.Count;
}

[Benchmark]
public int CountDown_with_Delayed_Change()
{
Expand Down
4 changes: 2 additions & 2 deletions fennecs.benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Runtime.Intrinsics.X86;
using Benchmark;
using Benchmark.Conceptual;
using Benchmark.ECS;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
Expand All @@ -15,13 +14,14 @@
.HideColumns("Job", "Error", "Median", "RatioSD");

var jobs = new List<Job>([
Job.MediumRun.WithId("Default").WithRuntime(CoreRuntime.Core90),
Job.ShortRun.WithId("Default").WithRuntime(CoreRuntime.Core90),
//Job.ShortRun.WithId("Native").WithRuntime(NativeAotRuntime.Net90),
]);


foreach (var job in jobs) config.AddJob(job);


// Most relevant vectorization instruction sets, add other intrinsics as needed.
// These are exclusions you can use to TURN OFF specific benchmarks based on the
// supported feature of the system.
Expand Down
4 changes: 0 additions & 4 deletions fennecs.benchmarks/fennecs.benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PlatformTarget>x64</PlatformTarget>
<TieredPGO>true</TieredPGO>
<TieredCompilation>true</TieredCompilation>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
<TieredCompilationQuickJitForLoops>true</TieredCompilationQuickJitForLoops>
</PropertyGroup>

<ItemGroup>
Expand Down
21 changes: 21 additions & 0 deletions fennecs/Delegates.1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using fennecs.storage;

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

namespace fennecs;


#region For/Job: Component Actions

public delegate void ComponentActionW<C0>(RW<C0> comp0) where C0 : notnull;
public delegate void ComponentActionR<C0>(R<C0> comp0) where C0 : notnull;

#endregion


#region For/Job: Entity Component Actions

public delegate void EntityComponentActionW<C0>(EntityRef entity, RW<C0> comp0) where C0 : notnull;
public delegate void EntityComponentActionR<C0>(EntityRef entity, R<C0> comp0) where C0 : notnull;

#endregion
Loading

0 comments on commit 301d71d

Please sign in to comment.