
[英]Why does the runtime of high_resolution_clock increase with the greater frequency I call it?
在下面的代码中,我重复调用std::chrono::high_resolution_clock::now两次,并测量这两次调用之间花费的时间。 我预计这次会非常小,因为在这两个调用之间没有运行其他代码。 但是,我观察到奇怪的行为。 正如预期的那样,对于小 N,最大元素在几纳秒内。 然而,我增加 N ...