This is mostly focused on cgltf_accessor_unpack_floats, but also adds a counterpart cgltf_accessor_unpack_indices.
The optimizations reduce the overhead by extracting some common code out of the per-element loop, and also implementing a fast path for direct memcpy. Without the fast path, this results in ~10% faster glTF parsing (tested end-to-end on Amazon Bistro exterior scene); with the fast-path, this makes the parsing 1.5x faster. Note that the time includes loading gltf/buffer data from files, parsing/validation and some minor data reorganization, so the gains may be more significant in other applications - the numbers above are from gltfpack.
This is mostly focused on cgltf_accessor_unpack_floats, but also adds a counterpart cgltf_accessor_unpack_indices.
The optimizations reduce the overhead by extracting some common code out of the per-element loop, and also implementing a fast path for direct memcpy. Without the fast path, this results in ~10% faster glTF parsing (tested end-to-end on Amazon Bistro exterior scene); with the fast-path, this makes the parsing 1.5x faster. Note that the time includes loading gltf/buffer data from files, parsing/validation and some minor data reorganization, so the gains may be more significant in other applications - the numbers above are from gltfpack.