qmuntal / gltf

Go library for encoding glTF 2.0 files
https://www.khronos.org/gltf/
BSD 2-Clause "Simplified" License
241 stars 32 forks source link

Optimize modeler.ReadAccessor for sparse accessors #83

Closed qmuntal closed 2 months ago

qmuntal commented 2 months ago

Improvements:

goos: windows
goarch: amd64
pkg: github.com/qmuntal/gltf/modeler
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
                      │   old.txt   │               new.txt               │
                      │   sec/op    │   sec/op     vs base                │
ReadAccessorSparse-12   1.834µ ± 8%   1.517µ ± 3%  -17.26% (p=0.000 n=10)

                      │  old.txt   │              new.txt              │
                      │    B/op    │    B/op     vs base               │
ReadAccessorSparse-12   328.0 ± 0%   304.0 ± 0%  -7.32% (p=0.000 n=10)

                      │  old.txt   │              new.txt               │
                      │ allocs/op  │ allocs/op   vs base                │
ReadAccessorSparse-12   9.000 ± 0%   6.000 ± 0%  -33.33% (p=0.000 n=10)