Get suggestions for improving code performance.
{{language}}Programming language
Example: Python
{{code}}Code to optimize
Example: for i in range(len(list)): ...
{{performance_issues}}Known issues
Example: Slow with large datasets
{{constraints}}Constraints
Example: Must remain readable
Optimize this JavaScript array processing code to reduce multiple iterations while staying ES6+ compatible.