Channels ▼   Benchmarking Block-Swapping Algorithms  Benchmarks
and Constants  Bentley benchmarked these algorithms on a 400 MHz
Pentium II, varying the size of the smaller subarray from 1 to
50, with an overall array of 1 million elements. He found that
the Reversal algorithm averaged near 66 nanoseconds per element,
Gries-Mills was below 50 ns per element, and the Juggling
algorithm was about 190 ns per element. Today's processors, such
as the Intel i7 860, run at 2.8 GHz (with TurboBoost, up to 3.46
GHz) and provide larger multilevel caches with automatic
prefetching.  Table 1 shows statistics gathered from performance
measurements for an input array of 1 million 32-bit elements,
split into two subarrays of all possible sizes, which are then
Block Exchanged using each of the three algorithms. The code was
compiled with Intel C++ Composer XE 2011.  Juggling Gries-Mills
Reversal Mean 0.00641 0.00122 0.00139 Standard Deviation 0.00194
0.00013 8.5E-05 Sample Variance 3.8E-06 1.7E-08 7.3E-09 Range
0.02049 0.003