It is really interesting to note here: http://en.cppreference.com/w/cpp/chrono/c/clock
"Only the difference between the two values โโreturned by various calls to std :: clock makes sense, since the beginning of the era std :: clock does not have to coincide with the beginning of the program. STD :: clock time may be faster or slower than a wall clock, depending from execution resources provided by the operating system by the operating system. For example, if the CPU is used by other processes, the time std :: clock may advance more slowly than the wall clock. On the other hand, if the current process is multithreaded and more than one execution core is available, in Remy std :: clock can accelerate faster than a wall clock. "
Why is the clock accelerated with multithreading? I check the performance of a C ++ program using streaming without it, and I notice that times are like streams (no better), but they feel faster (for example, they say 8 seconds in 3 seconds of execution time).
source
share