Javascript Vector Methods Cpp Performance Brakes