Giter Site home page Giter Site logo

Comments (2)

donmccurdy avatar donmccurdy commented on July 1, 2024 1

Concluding notes —


dequantize ✅

OK to iterate vertex attributes, because the attributes are processed only once, never cloned.

reorder ✅

Calls remapAttribute, iterates over the source attribute. Appears not to write any more than necessary, either way. Improved by switching from remapAttribute to compactAttribute. Further improved by reducing excess iteration over primitives sharing the same vertex stream.

unweld ✅

Did a clone on the vertex attributes before overwriting the array with setElement. Should be a shallow clone, and we can make the loop a bit tighter. Fixed both.

weld ✅

Use of remapPrimitive+remapAttribute resulted in iteration over the entire vertex attribute without need, even if only a subset was copied. Replaced with compactPrimitive / compactAttribute. Vastly faster on oval.gltf.

simplify ✅

Calls dequantizeAttributeArray unoptimally, and passes the entire vertex buffer into simplification when it can only really use the indexed positions.

quantize ✅

Clones and quantizes each attribute in isolation, without regard for indices. Then dedups to clean up at the end. Fixed, mostly with compactPrimitive.

oval.gltf:

  • before: 156.85s
  • after: 8.74s

join ✅

Compact primitives to isolate vertex streams and remove unused vertices on a per-primitive level. Then deep cloning primitives and transformPrimitive are cheaper. Then in joinPrimitives, fix call to remapAttribute to reduce allocations.

Remove skipIndices argument to transformPrimitive, now that we can guarantee vertex streams are isolated.

oval.gltf + join:

  • before: 74.39s
  • after: 2.34s (remaining time is I/O-constrained)

lovecraftian.glb + opt, join step only:

  • before: 219ms
  • after: 115ms

from gltf-transform.

donmccurdy avatar donmccurdy commented on July 1, 2024

Essentially the same issue coming up for join() in #1317, which I'll merge into this issue. The functions need to either be smarter about working only with the specific vertices indexed by a given primitive (not its entire vertex stream, possibly shared), or the functions need to be refactored to operate on some concept of a vertex stream. I suspect the first is more maintainable.

Another example file, available at:

https://www.dropbox.com/scl/fi/q1uisxtqoe7hj4d5gzm1r/world.zip?rlkey=1gt9q5t4ns9v8xwwx8gy6geo2&dl=0

from gltf-transform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.