Daily iOS
Performance and debugging

Approach to code optimization

You're asked to "optimize this function, it's slow." What do you do before you touch the code?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

First establish the current numbers and a target with a reproducible benchmark, pin down the bottleneck with a profiler, then change the code, and re-measure with the same benchmark afterward.

Share a question