donmccurdy / donmccurdy/glTF-Transform
dedup: Group material before check
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 206
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 16
Description
**Is your feature request related to a problem? Please describe.**
When running `dedup` on [NodePerformanceTest.glb](https://github.com/KhronosGroup/glTF-Sample-Assets/blob/main/Models/NodePerformanceTest/glTF-Binary/NodePerformanceTest.glb), it took 179s on `dedupMaterials`
**Describe the solution you'd like**
As comment states `dedupMaterials` runs a `O(n²)` compare, so it might help to group materials before compare. Pick some props that can diff from materials (mode, colors, textures, extensions), and hash them as the group key, then run `O(n²)` compare within each group.
**Describe alternatives you've considered**
Add an option to `dedup` that skips `dedupMaterials` if there are too many materials.
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
Research direction
Start with the dedupMaterials implementation and profile it against NodePerformanceTest.glb, where the issue reports 179 seconds. Evaluate grouping materials by differing properties before comparison, then confirm that deduplication behavior is preserved and the benchmark improves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100