SmartAddresser
SmartAddresser copied to clipboard
Optimize DependentObjectBasedAssetFilter by Using HashSet and Avoiding Redundant Dependency Collection
This filter can get quite slow when there are thousands of assets in a project.
This change refactors DependentObjectBasedAssetFilter to improve performance and simplify logic:
• Replaced List
This should reduce unnecessary allocations and redundant entries, especially in large asset sets, and make the filtering logic more efficient.
| Operation | List<T> |
HashSet<T> |
|---|---|---|
Check if element exists (Contains) |
O(n) | O(1) |
| Add element | O(1) | O(1) |
| Enforce uniqueness | Manual (Distinct() call, O(n log n)) |
Automatic during Add (O(1)) |