@@ -261,21 +261,10 @@ type L0Sublevels struct {
261261 addL0FilesCalled bool
262262}
263263
264- type sublevelSorter []* TableMetadata
265-
266- // Len implements sort.Interface.
267- func (sl sublevelSorter ) Len () int {
268- return len (sl )
269- }
270-
271- // Less implements sort.Interface.
272- func (sl sublevelSorter ) Less (i , j int ) bool {
273- return sl [i ].minIntervalIndex < sl [j ].minIntervalIndex
274- }
275-
276- // Swap implements sort.Interface.
277- func (sl sublevelSorter ) Swap (i , j int ) {
278- sl [i ], sl [j ] = sl [j ], sl [i ]
264+ func sortByMinIntervalIndex (files []* TableMetadata ) {
265+ slices .SortFunc (files , func (a , b * TableMetadata ) int {
266+ return stdcmp .Compare (a .minIntervalIndex , b .minIntervalIndex )
267+ })
279268}
280269
281270// NewL0Sublevels creates an L0Sublevels instance for a given set of L0 files.
@@ -331,7 +320,7 @@ func NewL0Sublevels(
331320 }
332321 // Sort each sublevel in increasing key order.
333322 for i := range s .levelFiles {
334- sort . Sort ( sublevelSorter ( s .levelFiles [i ]) )
323+ sortByMinIntervalIndex ( s .levelFiles [i ])
335324 }
336325
337326 // Construct a parallel slice of sublevel B-Trees.
@@ -623,7 +612,7 @@ func (s *L0Sublevels) AddL0Files(
623612
624613 // Sort each updated sublevel in increasing key order.
625614 for _ , sublevel := range updatedSublevels {
626- sort . Sort ( sublevelSorter ( newVal .levelFiles [sublevel ]) )
615+ sortByMinIntervalIndex ( newVal .levelFiles [sublevel ])
627616 }
628617
629618 // Construct a parallel slice of sublevel B-Trees.
0 commit comments