Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Is there something you have against profilers? They help a ton. Since you are on WinXP, you should really give a trial of vtune a try. Try a call graph sampling test and look at self time and total time of the functions being called. There's no better way to tune your program so that it's the fastest possible without being an assembly genius (and a truly exceptional one).</p> <p>Some people just seem to be allergic to profilers. I used to be one of those and thought I knew best about where my hotspots were. I was often correct about obvious algorithmic inefficiencies, but practically always incorrect about more micro-optimization cases. Just rewriting a function without changing any of the logic (ex: reordering things, putting exceptional case code in a separate, non-inlined function, etc) can make functions a dozen times faster and even the best disassembly experts usually can't predict that without the profiler.</p> <p>As for relying on simplistic timing tests alone, they are extremely problematic. That current test is not so bad but it's a very common mistake to write timing tests in ways in which the optimizer will optimize out dead code and end up testing the time it takes to do essentially a nop or even nothing at all. You should have some knowledge to interpret the disassembly to make sure the compiler isn't doing this.</p> <p>Also timing tests like this have a tendency to bias the results significantly since a lot of them just involve running your code over and over in the same loop, which tends to simply test the effect of your code when all the memory in the cache with all the branch prediction working perfectly for it. It's often just showing you best case scenarios without showing you the average, real-world case.</p> <p>Depending on real world timing tests is a little bit better; something closer to what your application will be doing at a high level. It won't give you specifics about what is taking what amount of time, but that's precisely what the profiler is meant to do.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COI used profilers before to optimize performance of entire programs, but given curiosity about a few simple fuctions, calling a few timers is definitely less hassle than choosing, downloading, installing, reading the manual and get working with a profiler. Altogether, there is a difference between understanding underlying stuff like this and getting your software working at reasonable performance. For the latter I would happily use a profiler and the speed of std::reverse would most likely not worry me at all, unless if I was reversing gigabytes...
      singulars
      1. This table or related slice is empty.
    2. COIf you are just going for acceptable performance and not exceptional performance, then a timing test might do. However, it's important to keep in mind that while a profiler might take a little time to learn, it's just something you have to do once. In vtune, just use the call graph sampling wizard, select your exe file, and run it. The only tricky part is that you need to modify your projects settings (http://software.intel.com/en-us/articles/performance-tools-for-software-developers-using-the-intel-compilers-with-vtune-analyzer-or-intel-thread-profiler/). After that just run and see graph.
      singulars
    3. CO... self time will then tell you how much time the cpu spends in a given function/class method excluding calls to other functions/methods, and total time will give you the total amount of time spent in a function/method including the time spent to call other functions/methods. It's just like a timing test except you get the time spent for every function called in your test including the total time spent in main.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload