Due to how BuildTreeBranch works, it does lots of erasures of the nodelist. Because it does so going from the beginning of the list and if the procedure is relatively large, it becomes almost a worst case scenario where hundreds of nodes are being copy-constructed (when shifting after erase) over and over as we progress from the first opcode to the last.
Better to use a linked list to reduce erase complexity. Should increase performance quite a lot.