
Ask HN: What do you recommend for optimization and profiling? - westicecoast32
I&#x27;m writing an app from scratch and I&#x27;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&#x27;s more I could learn.<p>Do you have any recommendations for profiling or optimization?
======
photawe
You know premature optimization is the root of all evil ;)

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.

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).

Having said that, I use dotTrace from JetBraints. It's for .net

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.

------
thomas43
Do you have some more detaile about your app?

I use perf, sysprof, trace32, visual studio profiler for profiling, but this
highly depends on your environment.

These assorted links might be interesting to you:

\- [https://github.com/Kobzol/hardware-
effects](https://github.com/Kobzol/hardware-effects)

\-
[https://www.youtube.com/watch?v=FJJTYQYB1JQ](https://www.youtube.com/watch?v=FJJTYQYB1JQ)

\- [https://godbolt.org/](https://godbolt.org/)

\- [http://igoro.com/archive/gallery-of-processor-cache-
effects/](http://igoro.com/archive/gallery-of-processor-cache-effects/)

------
chrisbennet
For windows I use 2 C++ profilers (memory and speed) from
[https://www.softwareverify.com/index.php](https://www.softwareverify.com/index.php)

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.

------
notemaker
Anyone have experience with coz? The talk made it seem brilliant, but I
haven't been able to make it work.

