Subject: [PATCH] world load measurement --- Index: common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java (revision 4cb09456567b65fe4ffb4a7955052c796487d6cc) +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java (date 1730745492934) @@ -159,6 +159,11 @@ return this.renderSectionManager.getBuilder().isBuildQueueEmpty(); } + private int framesBeforeDone = 0; + private long start = 0; + private long done = 0; + private int doneFrameCount = 0; + /** * Called prior to any chunk rendering in order to update necessary state. */ @@ -224,8 +229,10 @@ int maxChunkUpdates = updateChunksImmediately ? this.renderDistance : 1; + var neededUpdate = false; for (int i = 0; i < maxChunkUpdates; i++) { if (this.renderSectionManager.needsUpdate()) { + neededUpdate = true; profiler.popPush("chunk_render_lists"); this.renderSectionManager.update(camera, viewport, spectator); @@ -252,6 +259,20 @@ profiler.pop(); Entity.setViewScale(Mth.clamp((double) this.client.options.getEffectiveRenderDistance() / 8.0D, 1.0D, 2.5D) * this.client.options.entityDistanceScaling().get()); + + if (this.start == 0) { + this.start = System.nanoTime(); + } + if (!(!neededUpdate && this.renderSectionManager.getBuilder().isBuildQueueEmpty())) { + this.done = System.nanoTime(); + this.doneFrameCount = this.framesBeforeDone; + } + if (this.framesBeforeDone % 50 == 0) { + var time = (double)(this.done - this.start) / 1_000_000_000; + var fpsDuringLoad = this.doneFrameCount / time; + System.out.println("Loaded in " + time + "s, " + this.doneFrameCount + " frames, " + fpsDuringLoad + "fps average"); + } + this.framesBeforeDone++; } private void processChunkEvents() { @@ -286,6 +307,8 @@ this.renderSectionManager.destroy(); this.renderSectionManager = null; } + this.framesBeforeDone = 0; + this.start = 0; this.renderDistance = this.client.options.getEffectiveRenderDistance();