Whenever you're ready, walk me through how you'd approach this.
Describe a time you had to refactor a legacy piece of code to improve performance. Explain how you identified the bottleneck, evaluated the risks of changing established code, aligned with teammates, and measured the result. Keep your answer focused on your own decisions, trade-offs, and lessons learned.