improve performance of using std::vector