Giter VIP home page Giter VIP logo

Comments (4)

stevenvergenz avatar stevenvergenz commented on August 15, 2024 1

Wow, that's some intense savings. Nicely done!

from unitygltf.

stevenvergenz avatar stevenvergenz commented on August 15, 2024

I noticed that buffer data gets copied to the buffer view objects, which get copied to the accessor objects. All the copying seems wasteful, wouldn't it make more sense to provide access to the original buffer via a function that maps the index space? So in lieu of bytes[] GLTFBuffer.Data, you might have bytes[] GLTFBuffer.GetBytes(int offset, int byteLength), and have GLTFBufferView implement the same interface. That way you don't have to copy anything until it's converted to its final type in the accessor.

from unitygltf.

robertlong avatar robertlong commented on August 15, 2024

Performance greatly improved via manual deserialization in db40b19

Previously we were using JSON.NET's JsonConvert.DeserializeObject which uses reflection to deserialize the provided object.

I've moved everything to manual deserialization which removes all reflection and really speeds things up.

Sample Model Reflection Parse Time Reflection GCAlloc Manual Parse Time Manual GCAlloc
Lantern 389.40ms 7.6MB 31.56ms 99.6KB
Corset 377.99ms 7.8MB 29.36ms 55.7KB
BoomBox 384.86ms 7.8MB 29.29ms 85KB

There's probably still a lot more room for performance improvements, but I'm feeling pretty good about our parsing performance now.

from unitygltf.

donmccurdy avatar donmccurdy commented on August 15, 2024

Any idea why parsing here would be slower than JSON parsing in e.g. the browser? All three of the sample models above take ~3ms with JSON.parse() in Firefox, or 10x faster.. I suppose that's partly because the C# is processing the model into structured objects and typed values, whereas JS is looser about this? I'm testing on a different machine here of course, but it's a fairly old laptop so I'd be surprised if that's the difference.

from unitygltf.

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.