donmccurdy / donmccurdy/glTF-Transform

dedup: Group material before check

Open
#1,708 4 comments 0 reactions 0 assignees View on GitHub
feature package:functions
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`

Image

Image

**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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.