Closed qmuntal closed 2 months ago
Reduce reflection usage in binary.MakeSliceBuffer to improve performance.
binary.MakeSliceBuffer
goos: windows goarch: amd64 pkg: github.com/qmuntal/gltf/modeler cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz │ old.txt │ new.txt │ │ B/op │ B/op vs base │ ReadAccessorSparse-12 296.0 ± 0% 248.0 ± 0% -16.22% (p=0.000 n=10) ReadAccessorBuffer-12 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹ ReadAccessor-12 72.00 ± 0% 72.00 ± 0% ~ (p=1.000 n=10) ¹ ReadIndices-12 56.00 ± 0% 32.00 ± 0% -42.86% (p=0.000 n=10) ReadIndicesBuffer-12 48.00 ± 0% 24.00 ± 0% -50.00% (p=0.000 n=10) geomean 67.24 50.52 -24.87% ¹ all samples are equal │ old.txt │ new.txt │ │ allocs/op │ allocs/op vs base │ ReadAccessorSparse-12 6.000 ± 0% 4.000 ± 0% -33.33% (p=0.000 n=10) ReadAccessorBuffer-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ ReadAccessor-12 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹ ReadIndices-12 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ReadIndicesBuffer-12 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10) geomean 2.352 1.741 -25.98% ¹ all samples are equal
Reduce reflection usage in
binary.MakeSliceBuffer
to improve performance.