jpaver / opengametools

A set of open c++ game development tools that are lightweight, easy-to-integrate and free to use. Currently hosting a magicavoxel .vox full scene loader.
MIT License
373 stars 35 forks source link

_vox_array::resize optimization - grow by at least 1.5x #29

Closed dougbinks closed 2 years ago

dougbinks commented 2 years ago

Discovered that during vox file loading resize was being called with count+1, with capacity only being increased by 1 each time leading to very slow file reading for vox files with lots of models & instances - one file with many tens of thousands of such was taking over a half hour to load (I cancelled!), whereas after this optimization it took 18 seconds (including converting to my octree format in Avoyd).

This PR changes the resize to use the same approach you use elsewhere to avoid too many resizing calls.

jpaver commented 2 years ago

Good catch, thanks for the fix!

dougbinks commented 2 years ago

Thanks for the library :)