Best way to test code speed in C++ without profiler, or does it not make sense to try?

后端 未结 8 1999
忘了有多久
忘了有多久 2021-02-06 02:01

On SO, there are quite a few questions about performance profiling, but I don\'t seem to find the whole picture. There are quite a few issues involved and most Q & A ignore

8条回答
  •  北海茫月
    2021-02-06 02:47

    Wha? How to measure speed without a profiler? The very act of measuring speed is profiling! The question amounts to, "how can I write my own profiler?" And the answer is clearly, "don't".

    Besides, you should be using std::swap in the first place, which complete invalidates this whole pointless pursuit.

    -1 for pointlessness.

提交回复
热议问题