Skip to content

Decode saved section palettes directly - #615

Merged
jpenilla merged 1 commit into
masterfrom
feat/performance-experiments
Oct 16, 2026
Merged

jpenilla merged 1 commit into
masterfrom
feat/performance-experiments

Conversation

@jpenilla

@jpenilla jpenilla commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Saved-chunk snapshots no longer run vanilla's block state and biome container codecs. SectionDecoder reads the palette list and packed data itself, decoding each distinct palette entry once and caching it, and keeps the packed long[] as-is instead of copying it into a PalettedContainer. Snapshots now hold their own read-only SectionData rather than PalettedContainers, which also avoids Paper's different unpack signature.

Behavior matches vanilla: entries that fail to decode use their partial result or the default value, logged once per section; missing or invalid data fails the read; data stored as a numeric list rather than a long array is read through NbtOps. SectionDecoderTest checks these cases and a range of palette sizes against vanilla's codecs, so Minecraft updates that change vanilla's behavior should fail the tests.

Performance

Render time and throughput, master vs this PR

Sampled time in snapshot construction, codecs, biome coloration and block lookups

Saved block state and biome sections are decoded from their palette list and packed data without vanilla's container codecs. Each distinct palette entry is decoded once with the element codec and cached. Packed data stored as a long array is used without copying, so snapshots keep the source arrays; other numeric lists that vanilla accepts are read through NbtOps. Like vanilla, entries that fail to decode use their partial result or the default value and are logged once per section, and sections with missing or invalid data fail to read. Snapshots store their own read-only section data instead of PalettedContainers, which avoids Paper's different unpack signature.
@jpenilla
jpenilla merged commit b4a7f23 into master Oct 16, 2026
2 checks passed
@jpenilla
jpenilla deleted the feat/performance-experiments branch October 16, 2026 05:48
jpenilla added a commit that referenced this pull request Oct 16, 2026
Saved block state and biome sections are decoded from their palette list and packed data without vanilla's container codecs. Each distinct palette entry is decoded once with the element codec and cached. Packed data stored as a long array is used without copying, so snapshots keep the source arrays; other numeric lists that vanilla accepts are read through NbtOps. Like vanilla, entries that fail to decode use their partial result or the default value and are logged once per section, and sections with missing or invalid data fail to read. Snapshots store their own read-only section data instead of PalettedContainers, which avoids Paper's different unpack signature.

(cherry picked from commit b4a7f23)
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.

1 participant