- Do you think that low-level optimizations can improve the performance better than high-level optimizations?
You’re not going to find the first 10 million prime numbers with a brute force algorithm just by replacing ++ with +=2.
But you’re also not going to gain any performance by using dirty rectangles when the entire screen changes each frame.
Sometimes, low-level optimizations are all you’ve got.
- Do you think that we should begin with high-level optimizations and after that low-level optimizations in a project?
That totally depends. High-level optimizations can be hard to add later on, so it’s usually a good idea to implement them straight away. But on the other hand, I’m a strong believer in only adding code you actually USE, so don’t add fancy BSP type algorithms until your game has more than a single large rectangular room.
IMHO, it’s better to rewrite code to add new functionality (it gives you a nice reason to clean up your code anyway) than to write too much code from the start, locking yourself into a bad design.
This is only true for projects with two or less programmers, though. If you’ve got more than that, solid design from the start is much more important.
Low-level optimization, on the other hand, should NEVER be added unless you absolutely have to. It’s the opposite of clean code, it’s highly specialized code trying to solve a very specific problem acting under very specific assumptions. It basically moves the code in the opposite direction as what I suggested above (start specialized, then broaden over time).