if you have loops with 100+ iterations in practice, then yes, you should be using data_ptr<T> for “unboxing”. vector is not the best choice here, instead you can either work with pointers or use something like Eigen arrays (mapped).