Performance improvements
## Why?
Using a high number of recursive `If` was slowing down the compilation.
Profiling showed the bottleneck was `handleConflict`, a `O(N)` operation that happens everytime we add a new Node.
## The fix
I switched the `resourceNodes` `Set` to a "custom" `Map` class, `ResourceNodesMap`. This automatically manages the Map keys by concatenating the packType and the path components.
## Performance improvements
### Before
* Generating 1500 nested `if` took `33.430s`
* Generating 100k sequential `if` took `17.02s`
### After
* Generating 5000 nested `if` now takes `0.889s` (x37 🚀)
* Generating 100k sequential `if` now takes `2.254s` (x7.5 🚀 )
More generally, the new O(1) complexity means Sandstone will better scale on large projects.
合并状态:已合并 合并于 2025-08-17 关闭于 2025-08-17 0 条评论