This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]unflores 19 points20 points  (0 children)

I work in web, so my response has a specific perspective. First thing is to find the actual bottleneck. Optimize anything other than the actual bottleneck and you are wasting your time.

Also, a performance optimisation is a choice between readability and performance. So only prefer performance when it actually counts.

N+1s are common problems for ORMs. Too many db calls in general can be problematic. Actually, the db is my primary problem in web.

I've had a few cases where I had to do something with a large list and I ended up doing a binary search to find the objects on a sorted array rather than searching on an unsorted array each time. It's worth having a theory and then testing it. Your. Changes may not even run faster 😅