|Cool VL Viewer forum
|Remove useless std::list in lljoint mChildren
|Page 1 of 1|
|Author:||kathrine [ 2020-10-07 23:30:33 ]|
|Post subject:||Remove useless std::list in lljoint mChildren|
It seems the std::list for mChildren is mostly useless. A std::vector seems better and just needs a tiny change that actually looks like and improvment as well.
|Author:||Henri Beauchamp [ 2020-10-08 14:14:03 ]|
|Post subject:||Re: Remove useless std::list in lljoint mChildren|
Not really, no... The children joints list is totally essential.
Indeed, the std::list is an over-kill.
However one thing to be careful about with std::vector is to avoid erase() operations in them (way more costly than in std::list case, because it will most often involve moving "down" a part of the vector in memory). A nifty trick (as long as you do not care about the entries order, which is the case here) is to copy the last entry of the vector into the entry you remove (if it is not the last entry already) and pop back the last entry of the vector... Only one entry move involved.
I will also use the std::vector indexed access instead of the costly iterators in all the loops using mChildren.
Thanks for pointing this !
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group