Instead of yielding the thread, sleep for one micro second.
Instead of yielding the thread, sleep for one micro second.

This significantly improves the performance of the threaded
test example. The reason are the far reduced numbers of context
switches (goes down by about 90%):

Perf stat results averaged over ten runs are:

before:
       1537.459666      task-clock (msec)         #    2.741 CPUs utilized            ( +-  1.98% )
           164,214      context-switches          #    0.107 M/sec                    ( +-  4.77% )
             1,238      cpu-migrations            #    0.805 K/sec                    ( +-  1.42% )
             3,996      page-faults               #    0.003 M/sec                    ( +-  0.26% )
     3,531,767,774      cycles                    #    2.297 GHz                      ( +-  1.96% ) [56.85%]
   <not supported>      stalled-cycles-frontend
   <not supported>      stalled-cycles-backend
     4,404,564,712      instructions              #    1.25  insns per cycle          ( +-  1.81% ) [82.34%]
       895,286,284      branches                  #  582.315 M/sec                    ( +-  1.83% ) [82.05%]
        14,800,878      branch-misses             #    1.65% of all branches          ( +-  2.07% ) [83.04%]

       0.560967210 seconds time elapsed                                          ( +-  1.78% )

after:

        940.204408      task-clock (msec)         #    1.970 CPUs utilized            ( +-  0.97% )
            16,628      context-switches          #    0.018 M/sec                    ( +-  2.09% )
             1,709      cpu-migrations            #    0.002 M/sec                    ( +-  2.02% )
             3,733      page-faults               #    0.004 M/sec                    ( +-  0.62% )
     2,299,207,706      cycles                    #    2.445 GHz                      ( +-  0.95% ) [54.67%]
   <not supported>      stalled-cycles-frontend
   <not supported>      stalled-cycles-backend
     3,203,389,330      instructions              #    1.39  insns per cycle          ( +-  1.48% ) [84.25%]
       717,416,828      branches                  #  763.043 M/sec                    ( +-  1.01% ) [77.86%]
        11,127,629      branch-misses             #    1.55% of all branches          ( +-  0.98% ) [76.95%]

       0.477194059 seconds time elapsed                                          ( +-  0.34% )

Note that we utilize less CPUs (which is good, as it safes power), but
still decrease the total run time, as do number of cycles spent
and instructions executed.

muojp/heaptrack,muojp/heaptrack,stormspirit/heaptrack,stormspirit/heaptrack,muojp/heaptrack,muojp/heaptrack,stormspirit/heaptrack,muojp/heaptrack