Improve performance for model builder when adding vertex. #45
RobEwbank1
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When building models in C++ using model builder it's does quite a bit of heavy lifting that in some cases it's not needed. I'd like to add a couple of ways to improve performance.
VtxIdxType ModelBuilder::AddVertexFast(const Vertex &vtx) { auto &list = lists.back(); size_t idx = list.vtx.size(); list.vtx.push_back(vtx); return VtxIdxType(idx); }
void ModelBuilder::ReserveCurrentList(size_t size){ auto &list = lists.back(); list.vtx.reserve(size); list.idx.reserve(size); }
This will prevent re-allocation in the vectors if you know in advanced how many verts you have.
Please let me know your thoughts
Beta Was this translation helpful? Give feedback.
All reactions