[PR #3900] [MERGED] Fix O(n^2) function-tag resolution and tag cycles #5278

Closed
opened 2026-11-03 05:11:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3900
Author: @DUzzL
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/issue-3885-function-tag-dedupe


📝 Commits (1)

  • a5f4e32 Dedupe function-tag expansion with hash sets and end tag cycles

📊 Changes

1 file changed (+49 additions, -5 deletions)

View changed files

📝 crates/horizon-client-render/src/datapack.rs (+49 -5)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #3885

DataStore::tag_functions deduplicated with Vec::contains, making a 20k-entry #minecraft:tick tag O(n^2) on every tick. It now uses a HashSet for functions (first-seen order kept) and a visited-tag set, so cycles terminate and the silent depth-16 cap is gone.

Not done: caching the resolved list per reload (resolution is now linear per call).

Tests: cargo test -p horizon-client-render --lib datapack (7 passed), including a new test for 50k entries, a tag cycle and 40-level nesting.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3900 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/issue-3885-function-tag-dedupe` --- ### 📝 Commits (1) - [`a5f4e32`](https://github.com/horizon-rust/horizon/commit/a5f4e32bfcd4021696d138e90b0aa70fb4b448fd) Dedupe function-tag expansion with hash sets and end tag cycles ### 📊 Changes **1 file changed** (+49 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/datapack.rs` (+49 -5) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #3885 `DataStore::tag_functions` deduplicated with `Vec::contains`, making a 20k-entry `#minecraft:tick` tag O(n^2) on every tick. It now uses a `HashSet` for functions (first-seen order kept) and a visited-tag set, so cycles terminate and the silent depth-16 cap is gone. Not done: caching the resolved list per reload (resolution is now linear per call). Tests: `cargo test -p horizon-client-render --lib datapack` (7 passed), including a new test for 50k entries, a tag cycle and 40-level nesting. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:27 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5278
No description provided.