Repository navigation
Reduce allocations and redundant work in a few render paths - #869
Open
BonsUnleashed wants to merge 1 commit into
Open
BonsUnleashed wants to merge 1 commit into
BonsUnleashed wants to merge 1 commit into
Conversation
The shader renderer spends time organizing small pieces of data, including lists with nothing in them. These changes reuse suitable objects and skip unnecessary empty-list work. They reduce preparation work and temporary memory while keeping the same shader settings and drawing results. Source port of a change shipped in Bons and Furious 1.0.15.
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A set of small, independent changes on per-frame paths. Each keeps the same output. Happy to split them up if that's easier to review.
FullyBufferedMultiBufferSource: the buffer affinity LRU is anObject2IntLinkedOpenHashMap(getAndMoveToLast/removeFirstInt) instead of aLinkedHashMap<RenderType, Integer>, so lookups don't box.GraphTranslucencyRenderOrderManager:reset()keeps graphs that stayed empty instead of allocating new ones, and empty graphs skip the feedback arc set and toposort.IrisRenderSystem.unbindAllSamplers: returns early when no sampler has been bound since the last call.ProgramUniforms/ProgramSamplers: indexed loops over the immutable lists instead of iterators.CustomUniforms.push: walks theObject2IntOpenHashMapwithfastForEachso locations aren't boxed.AdvancedShadowCullingFrustum: the two cross products write into the plane normal vectors, which aren't used afterwards, instead of new vectors.ModelToEntityVertexSerializer: reads each vertex value once, reads the captured entity, block entity and item ids once per quad, and copies the 36-byte vertex with fixed-size loads.Measured with the same changes applied to 1.8.0, which is still this branch's version. For example, converting 256 vertices went from about 3.9 µs to 2.6 µs, and buffer affinity lookups from about 53 ns to 24 ns with no allocation. These are per-method numbers, not frame times.
Compiles on
1.20.1-new(compileJava compileSodiumCompatibilityJava). Not tested in game on this branch.Bons and Furious currently ships a patch for this: CurseForge · Modrinth (page still in review) · GitHub release