While the JavaScript performance will be unaffected, thousands of ids make your HTML bigger, increasing the load time and traffic cost. It's probably negligible (compressing images and other resources is far more important), but may be a route for optimization nevertheless.