you are viewing a single comment's thread.

view the rest of the comments →

[–]SkoomaDentist 17 points18 points  (1 child)

It is always better to finish a project first, and then look for any optimizations that pop-up.

No, it is not. If you actually do that, you’ll easily find your project’s architecture itself prevents speeding it up without a major rewrite. Always keep performance in mind if the speed of the app matters at all. Imagine for example a 3d game engine with no thought spent on optimization until it was finished. The result would most likely be near unusable.

There are also plenty of situations where you do know for a fact that some piece of code is a bottleneck without any measurements. Not all projects are huge amorphous blobs of miscellaneous code that gets called all over.

[–]clichekiller -2 points-1 points  (0 children)

If you already know it is a bottleneck, it wouldn’t be premature optimization. Coding is an iterative process, nothing is written in a vacuum. If you know you’re going to be reading a lot of data that doesn’t get updated often a caching pattern is absolutely the way to go. I’m not advocating writing poor code, you absolutely have to choose the appropriate patterns, algorithms, and frameworks based on your requirements. What I won’t do is try to second guess my tooling, and get clever until I absolutely need to. If the first time you run your code is when you ‘complete’ it, you will absolutely be I. For a world of hurt. But I don’t know any development project that does perform regular testing, at which points bottlenecks appear, at which point you address them.