Update render graph

This commit is contained in:
2026-01-13 13:46:50 +09:00
parent 954e3756aa
commit 02df8d7732
11 changed files with 291 additions and 261 deletions

View File

@@ -1,38 +1,38 @@
using Ghost.Core;
using Ghost.RenderGraph.Concept;
using Ghost.RenderGraph.Concept.Benchmark;
var renderGraph = new RenderGraph();
#if !DEBUG
BenchmarkDotNet.Running.BenchmarkRunner.Run<RenderGraphBenchmark>();
return;
//const int _ITERATION = 500000;
//for (var i = 0; i < _ITERATION; i++)
//{
// RenderGraphBenchmark.ExecuteGraph(renderGraph);
//}
var renderGraph = new RenderGraph();
const int _ITERATION = 500000;
for (var i = 0; i < _ITERATION; i++)
{
RenderGraphBenchmark.ExecuteGraph(renderGraph);
}
//GC.Collect();
//GC.WaitForPendingFinalizers();
////Thread.Sleep(1000); // Leave a gap in visual studio allocations timeline
//var sw = new System.Diagnostics.Stopwatch();
//var gcBefore = GC.GetAllocatedBytesForCurrentThread();
//sw.Start();
GC.Collect();
GC.WaitForPendingFinalizers();
//Thread.Sleep(1000); // Leave a gap in visual studio allocations timeline
var sw = new System.Diagnostics.Stopwatch();
var gcBefore = GC.GetAllocatedBytesForCurrentThread();
sw.Start();
//for (var i = 0; i < _ITERATION; i++)
//{
// RenderGraphBenchmark.ExecuteGraph(renderGraph);
//}
for (var i = 0; i < _ITERATION; i++)
{
RenderGraphBenchmark.ExecuteGraph(renderGraph);
}
//sw.Stop();
//var gcAfter = GC.GetAllocatedBytesForCurrentThread();
sw.Stop();
var gcAfter = GC.GetAllocatedBytesForCurrentThread();
//Console.WriteLine($"{sw.Elapsed.TotalNanoseconds / _ITERATION} ns (per iteration)");
//Console.WriteLine($"GC Allocated Bytes: {(gcAfter - gcBefore) / _ITERATION} bytes (per iteration)");
Console.WriteLine($"{sw.Elapsed.TotalNanoseconds / _ITERATION} ns (per iteration)");
Console.WriteLine($"GC Allocated Bytes: {(gcAfter - gcBefore) / _ITERATION} bytes (per iteration)");
#else
var renderGraph = new RenderGraph();
// Run twice to demonstrate cache hit
Console.WriteLine("=== FRAME 1 (Cache Miss Expected) ===");
RenderGraphBenchmark.ExecuteGraph(renderGraph);