A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Sorting 11m strings on EC2 c4.2xlarge | ||||||||||||||||||||||||
2 | Radix sort (ByBytes) | Quicksort | |||||||||||||||||||||||
3 | Max procs | Wall time (sec) | CPU time (sec) | CPU use % | % of ideal use | CPU waste % | Wall time (sec) | CPU time (sec) | CPU use % | % of ideal use | CPU waste % | ||||||||||||||
4 | 1 | 10.3 | 10.4 | 100.97% | 100.97% | 16.5 | 16.64 | 100.85% | 100.85% | ||||||||||||||||
5 | 2 | 6.8 | 10.65 | 156.62% | 78.31% | 2.40% | 8.8 | 17.15 | 194.89% | 97.44% | 3.06% | ||||||||||||||
6 | 4 | 4.7 | 12.13 | 258.09% | 64.52% | 16.63% | 5.7 | 18.61 | 326.49% | 81.62% | 11.84% | ||||||||||||||
7 | 8 | 3.3 | 12.09 | 366.36% | 45.80% | 16.25% | 3.5 | 18.4 | 525.71% | 65.71% | 10.58% | ||||||||||||||
8 | 16 | 2.7 | 15.3 | 566.67% | 35.42% | 47.12% | 3.2 | 24.77 | 774.06% | 48.38% | 48.86% | ||||||||||||||
9 | "CPU waste %" is the total-CPU-time delta from the 1-proc sort; higher is bad. The 16 procs % may be high from using Intel's hardware threads which aren't as helpful as real cores. Unsure. | ||||||||||||||||||||||||
10 | The data sorted is http://dumps.wikimedia.org/enwiki/20141208/enwiki-20141208-all-titles-in-ns0.gz, shuffled with sort -R. All sorts are of [][]bytes, with the file mmap'd. | ||||||||||||||||||||||||
11 | These timings are with a slightly old revision, but should match what you'd get today--only the API has changed, not the algorithms. | ||||||||||||||||||||||||
12 | Parallel radix sort v. parallel quicksort | Parallel radix sort v. serial quicksort | Parallel vs. serial radix sort | ||||||||||||||||||||||
13 | Max procs | Wall delta | CPU delta | Max procs | Wall delta | CPU delta | Max procs | Wall delta | CPU waste % | ||||||||||||||||
14 | 1 | -37.58% | -37.50% | 1 | -37.58% | -37.50% | 1 | 0.00% | 0.00% | ||||||||||||||||
15 | 2 | -22.73% | -37.90% | 2 | -58.79% | -36.00% | 2 | -33.98% | 2.40% | ||||||||||||||||
16 | 4 | -17.54% | -34.82% | 4 | -71.52% | -27.10% | 4 | -54.37% | 16.63% | ||||||||||||||||
17 | 8 | -5.71% | -34.29% | 8 | -80.00% | -27.34% | 8 | -67.96% | 16.25% | ||||||||||||||||
18 | 16 | -15.63% | -38.23% | 16 | -83.64% | -8.05% | 16 | -73.79% | 47.12% | ||||||||||||||||
19 | Qsort is better at keeping all cores busy, but not by quite enough to catch up to radix sort in wall time. | The radix win outweighed the parallelization costs, though total CPU time got close at 16 procs. | |||||||||||||||||||||||
20 | |||||||||||||||||||||||||
21 | |||||||||||||||||||||||||
22 | benchcmp of radixsort and stdlib sort on EC2 t2.medium | ||||||||||||||||||||||||
23 | With -cpu=1 | With -cpu=2 | |||||||||||||||||||||||
24 | benchmark | old ns/op | new ns/op | delta | benchmark | old ns/op | new ns/op | delta | |||||||||||||||||
25 | BenchmarkSortString1K | 339428 | 275374 | -18.87% | BenchmarkSortString1K-2 | 374884 | 298033 | -20.50% | |||||||||||||||||
26 | BenchmarkSortInt1K | 147559 | 52741 | -64.26% | BenchmarkSortInt1K-2 | 186007 | 90019 | -51.60% | |||||||||||||||||
27 | BenchmarkSortInt64K | 14385182 | 3228304 | -77.56% | BenchmarkSortInt64K-2 | 14367618 | 2535033 | -82.36% | |||||||||||||||||
28 | BenchmarkSort1e2 | 68821 | 72587 | +5.47% | BenchmarkSort1e2-2 | 68880 | 72560 | +5.34% | |||||||||||||||||
29 | BenchmarkSort1e4 | 15154898 | 6455438 | -57.40% | BenchmarkSort1e4-2 | 15175015 | 6700472 | -55.85% | |||||||||||||||||
30 | BenchmarkSort1e6 | 2395248933 | 701996155 | -70.69% | BenchmarkSort1e6-2 | 2372841030 | 465819031 | -80.37% | |||||||||||||||||
31 | |||||||||||||||||||||||||
32 | |||||||||||||||||||||||||
33 | |||||||||||||||||||||||||
34 | |||||||||||||||||||||||||
35 | |||||||||||||||||||||||||
36 | |||||||||||||||||||||||||
37 | |||||||||||||||||||||||||
38 | |||||||||||||||||||||||||
39 | |||||||||||||||||||||||||
40 | |||||||||||||||||||||||||
41 | |||||||||||||||||||||||||
42 | |||||||||||||||||||||||||
43 | |||||||||||||||||||||||||
44 | |||||||||||||||||||||||||
45 | |||||||||||||||||||||||||
46 | |||||||||||||||||||||||||
47 | |||||||||||||||||||||||||
48 | |||||||||||||||||||||||||
49 | |||||||||||||||||||||||||
50 | |||||||||||||||||||||||||
51 | |||||||||||||||||||||||||
52 | |||||||||||||||||||||||||
53 | |||||||||||||||||||||||||
54 | |||||||||||||||||||||||||
55 | |||||||||||||||||||||||||
56 | |||||||||||||||||||||||||
57 | |||||||||||||||||||||||||
58 | |||||||||||||||||||||||||
59 | |||||||||||||||||||||||||
60 | |||||||||||||||||||||||||
61 | |||||||||||||||||||||||||
62 | |||||||||||||||||||||||||
63 | |||||||||||||||||||||||||
64 | |||||||||||||||||||||||||
65 | |||||||||||||||||||||||||
66 | |||||||||||||||||||||||||
67 | |||||||||||||||||||||||||
68 | |||||||||||||||||||||||||
69 | |||||||||||||||||||||||||
70 | |||||||||||||||||||||||||
71 | |||||||||||||||||||||||||
72 | |||||||||||||||||||||||||
73 | |||||||||||||||||||||||||
74 | |||||||||||||||||||||||||
75 | |||||||||||||||||||||||||
76 | |||||||||||||||||||||||||
77 | |||||||||||||||||||||||||
78 | |||||||||||||||||||||||||
79 | |||||||||||||||||||||||||
80 | |||||||||||||||||||||||||
81 | |||||||||||||||||||||||||
82 | |||||||||||||||||||||||||
83 | |||||||||||||||||||||||||
84 | |||||||||||||||||||||||||
85 | |||||||||||||||||||||||||
86 | |||||||||||||||||||||||||
87 | |||||||||||||||||||||||||
88 | |||||||||||||||||||||||||
89 | |||||||||||||||||||||||||
90 | |||||||||||||||||||||||||
91 | |||||||||||||||||||||||||
92 | |||||||||||||||||||||||||
93 | |||||||||||||||||||||||||
94 | |||||||||||||||||||||||||
95 | |||||||||||||||||||||||||
96 | |||||||||||||||||||||||||
97 | |||||||||||||||||||||||||
98 | |||||||||||||||||||||||||
99 | |||||||||||||||||||||||||
100 |