Javascript Vector Methods Cpp Performance