When to profile?
Profiling is super cool, but we need to know when it is appropriate to do it, and in what measure we need to address the results we get from it.
Donald Knuth once said, "premature optimization is the root of all evil",
and, although I wouldn't have put it down so drastically, I do agree with him. After all, who am I to disagree with the man who gave us The Art of Computer Programming, TeX, and some of the coolest algorithms I have ever studied when I was a university student?
So, first and foremost: correctness. You want your code to deliver the correct results, therefore write tests, find edge cases, and stress your code in every way you think makes sense. Don't be protective, don't put things in the back of your brain for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access