I'm writing an app from scratch and I'd like to pay attention to places where I can optimize and profile things. So far I converted a few important functions to SIMD and wrote my own algorithm for another. The other day I got a tip on branch prediction and realized there's more I could learn.<p>Do you have any recommendations for profiling or optimization?
You know premature optimization is the root of all evil ;)<p>Personally, I do optimization every now and then, when I see bottlenecks and I see that it hurts the UI. Then you run some profiling tools and optimize those hot paths.<p>Optimizing from the get go will probably end up with you optimizing too much and the benefits will likely be invisible (and worst of all, optimizing will surely take quite a bit of extra time, and you can also end up with buggier code).<p>Having said that, I use dotTrace from JetBraints. It's for .net<p>If you expect your project will be complex, I would advise against C/C++, since that will complicate stuff even further (note: I've actually done 13 years of C++, so I do know what I'm talking about). I would recommend C#/F# - you'd be waaay more productive there.
Do you have some more detaile about your app?<p>I use perf, sysprof, trace32, visual studio profiler for profiling, but this highly depends on your environment.<p>These assorted links might be interesting to you:<p>- <a href="https://github.com/Kobzol/hardware-effects" rel="nofollow">https://github.com/Kobzol/hardware-effects</a><p>- <a href="https://www.youtube.com/watch?v=FJJTYQYB1JQ" rel="nofollow">https://www.youtube.com/watch?v=FJJTYQYB1JQ</a><p>- <a href="https://godbolt.org/" rel="nofollow">https://godbolt.org/</a><p>- <a href="http://igoro.com/archive/gallery-of-processor-cache-effects/" rel="nofollow">http://igoro.com/archive/gallery-of-processor-cache-effects/</a>
For windows I use 2 C++ profilers (memory and speed) from
<a href="https://www.softwareverify.com/index.php" rel="nofollow">https://www.softwareverify.com/index.php</a><p>I like to memory profile on a regular basis. It a is lot easier to catch and fix a memory leak if you discover it soon after you’ve introduced it.