Performance can be a daunting subject when it comes to programming. For example, some people are absolutely adamant that boxing is the root of all evil. Other people think that string concats are a great success.
In reality, everything is relative, and it all comes down to the context in which you are speaking. If you are programming on a mobile device, you will need to optimize more than if you were working on a desktop application.
This usually comes down to a trade-off between code efficiency and elegance. Let's say you created the most amazingly elegant, convenient, and understandable code base in the world. As soon as we launch some performance optimizations, we start code clouds with some, possibly opposing, intuitive, very specialized things. If we went to the city for optimization, we could make a performance saving, for example, 5 or 10 percent, but in the process completely destroy the elegance of the code.
Question: "Is it worth it?".
If performance is absolutely critical to your project, then run the profiler on your code. If you find that 90% of your CPU time is consumed using a particularly inefficient method, then this method is a good candidate for optimization. This is usually not worth pursuing the benefits of poor performance if you are not working with a performance-critical application.
Doctor Jones Nov 20 '08 at 11:32 2008-11-20 11:32
source share