There's a nice tool in JS world called jsperf. It allows one to profile several snippets of code at once to detemine which of them are most performant.

There's a lot of performance analysers for C++, but the ones I've seen were just console applications or IDE plugins for profiling.

Is there a performance analyser with similar interface?

  • Why do you ask? If your goal is to make your code as fast as possible, there's a misconception, at least 30 years old, that you have to analyze and measure the performance of its parts. That's wrong. You don't need to measure or analyze. All you have to do is let the slow parts naturally expose themselves, like this. – Mike Dunlavey Jun 13 '15 at 1:39
  • @MikeDunlavey jsperf is used to optimize e.g. loop kernels that are already known to be performance bottlenecks. It lets you compare several versions of the code to choose the most performant one. The question is not about searcing for slow parts of code at all. I've found VTune to be a good solution for C++ development, though I still have to guess amounts of iterations and filter deviating results to get statistically sound results, while jsperf does this internally. – polkovnikov.ph Jun 13 '15 at 21:31
  • If you know where to look, it's an easy problem - just time the different versions. The more common situation is a) there are multiple speedups in the code, b) you don't know where they are, and c) they hide from profilers (including VTune), leading you to think the code is optimal when it isn't. Some detail, in particular why "statistical soundness" is not useful, and explaining what does work. – Mike Dunlavey Jun 13 '15 at 23:36
  • @MikeDunlavey The whole problem is in that "just" word you used. There's no tools for that. The post you've linked is about soundness of your "tiresome for no good reason profiling via debugger" method, while I'm talking about statistical soundness of time measurement results. If OS scheduler switches the currently running program while you measure run time of the program, the run time will be a bit larger, and you will not even know how much the value was tainted. – polkovnikov.ph Jun 13 '15 at 23:54
  • @MikeDunlavey The best method I know is "minimal N run times of several runs of K iterations of algorithm, correct K after several runs to get statistically better results" method was developed, and I'm no good in doing it by hand. – polkovnikov.ph Jun 14 '15 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.