Skip to content

Improve saving#730

Merged
louis-e merged 2 commits intomainfrom
save-faster
Jan 31, 2026
Merged

Improve saving#730
louis-e merged 2 commits intomainfrom
save-faster

Conversation

@louis-e
Copy link
Owner

@louis-e louis-e commented Jan 31, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 31, 2026 17:21
@github-actions
Copy link

⏱️ Benchmark run finished in 0m 24s
🧠 Peak memory usage: 948 MB

📈 Compared against baseline: 30s
🧮 Delta: -6s
🔢 Commit: 45afd7b

✅ This PR improves generation time.

📅 Last benchmark: 2026-01-31 17:22:55 UTC

You can retrigger the benchmark by commenting retrigger-benchmark.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the world saving performance by caching base chunk sections and removing unnecessary merge logic when creating fresh worlds.

Changes:

  • Introduces OnceLock for caching base chunk sections (grass at Y=-62) to avoid recomputing them for every empty chunk
  • Simplifies save_single_region() by removing logic that reads and merges existing chunk data, since the code always creates fresh region files with .truncate(true)
  • Adds Clone trait to Section, Blockstates, and PaletteItem structs to support efficient section caching

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/world_editor/java.rs Adds OnceLock caching for base chunk sections, simplifies save_single_region by removing merge logic, and marks unused helper functions as dead_code
src/world_editor/common.rs Adds Clone trait to Section, Blockstates, and PaletteItem for efficient cloning of cached sections
src/data_processing.rs Adds new block type imports (GRASS, SMOOTH_STONE, STONE_BRICK_SLAB) though they appear unused

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@louis-e louis-e merged commit 516b9ec into main Jan 31, 2026
2 checks passed
@louis-e louis-e deleted the save-faster branch January 31, 2026 17:42
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.

2 participants