Skip to content

Share neighbour cache across render paths, add /greedybench - #26

Merged
programmer1o1 merged 3 commits into
masterfrom
perf/shared-section-cache
Nov 19, 2026
Merged

programmer1o1 merged 3 commits into
masterfrom
perf/shared-section-cache

Conversation

@programmer1o1

Copy link
Copy Markdown
Owner

What

  • Neighbour cache on vanilla and VulkanMod. These paths now read block state, light and AO occlusion through GreedySectionCache, as the Sodium path already did, instead of querying the world for every AO corner.
  • Shared GreedyFaceVisibility. populateFaceVisibility, the flat-water check and the AO key were copy-pasted across the three mixins. They now live in one place (about 500 lines removed, 184 added). Unused imports and constants are cleaned up.
  • Build timer and /greedybench [rounds]. Records the per-section greedy build time (shown in the debug HUD) and adds a client command that rebuilds all loaded sections for N rounds and prints each round's average plus the median and spread. F3+L's compile-queue metric does not see Sodium's chunk builder, so it could not measure this.
  • Flat Lighting config. isFlatLighting() now parses flat-lighting.json with Gson and re-reads it only when its modified time changes (follow-up to Flat Lighting Compatibility patch #25). A missing or key-less file still means "not flat", since Flat Lighting defaults cardinalLighting to true.
  • Test datapack in testing/ (generated by testing/generate_test_pack.py) that builds a gallery of scenes for visual and performance checks. See testing/README.md.

Measured

26.3, same spot in the test gallery, about 342 sections per round, 10 rounds each:

median per section mean without round 1
before, vanilla rendering 0.693 ms 0.692 ms
after, vanilla rendering 0.635 ms 0.625 ms

About 8-10% faster on the vanilla path. On Sodium the two builds were the same (about 0.16-0.19 ms), as expected, since that path already had the cache and only got the dedupe.

Not verified

  • Only compiled locally on 1.21.1, 1.21.2, 1.21.4, 1.21.8, 1.21.11, 26.1, 26.2 and 26.3. The Stonecutter version branches for the rest are what CI should confirm.
  • Ran in-game on 26.3 only. The VulkanMod path is compile-checked, not run.
  • The Flat Lighting change is untested in-game.
  • The test datapack's pack.mcmeta format fields for 1.21.9+ are untested.

The vanilla and VulkanMod paths now read block state, light and AO
occlusion through GreedySectionCache like the Sodium path already did,
instead of hitting the world for every AO corner. Measured on vanilla
rendering: about 8-10% faster per section (median 0.635 vs 0.693 ms).

populateFaceVisibility, the flat-water check and the AO key were copied
across the three mixins; they now live in GreedyFaceVisibility. Unused
imports and constants left behind are removed.

Adds a per-section greedy build timer (shown in the debug HUD) and
/greedybench [rounds], which rebuilds all loaded sections and prints
the average, median and spread, since F3+L's compile queue does not see
Sodium's chunk builder.
Generated datapack that builds a gallery of scenes on a flat world
(walls, AO pillars, water, glass, lighting, orientation blocks, biome
tint, roof, noise, pyramids, corridor, checkerboard) for visual and
performance checks. See testing/README.md.
isFlatLighting() matched the raw text with replace/contains, which broke
on tabs or newlines in the JSON. It now parses the file with Gson and
re-reads it only when its modified time changes, checked at most once a
second.

Flat Lighting defaults cardinalLighting to true and only writes its
config after the option is toggled, so a missing, unreadable or key-less
file still means "not flat". Also imports Files instead of using the
fully qualified name.
Copilot AI balanced review requested due to automatic review settings November 19, 2026 11:47

This comment was marked as off-topic.

@programmer1o1
programmer1o1 merged commit 67b4733 into master Nov 19, 2026
1 check passed
@AshenSolYT

Copy link
Copy Markdown

that's crazy that you can still squeeze more performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants