Commit 9aedff3
committed
simplex: slices.SortFunc for the dual ratio test (zero-alloc, generic)
Follow-up to e9d9386. Microbenchmark (200-elem tie-heavy sort, the ratio
test's shape): sort.Slice 6743ns/3allocs, sort.Sort-Interface 3269ns/1alloc,
slices.SortFunc 3080ns/0allocs. slices.SortFunc is 2.2x over the original
sort.Slice and 6%-faster + zero-alloc over the concrete sort.Interface (whose
1 alloc was interface boxing, x82k+ sorts). Order is byte-identical to
sort.Sort — verified across 200 tie-heavy seeds (a throwaway test) and by 020
staying at 774 nodes / 182619 pivots. Drops the concrete sort types. All
tests + PuLP green.1 parent d5c8f4e commit 9aedff3
2 files changed
Lines changed: 20 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 42 | | |
51 | 43 | | |
52 | 44 | | |
| |||
246 | 238 | | |
247 | 239 | | |
248 | 240 | | |
249 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
693 | 701 | | |
694 | 702 | | |
695 | 703 | | |
| |||
804 | 812 | | |
805 | 813 | | |
806 | 814 | | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | 815 | | |
817 | 816 | | |
818 | 817 | | |
| |||
0 commit comments