Skip to content

refactor: replace sort package with slices for improved sorting performance#809

Open
Not-Dhananjay-Mishra wants to merge 1 commit intoOneBusAway:mainfrom
Not-Dhananjay-Mishra:sort
Open

refactor: replace sort package with slices for improved sorting performance#809
Not-Dhananjay-Mishra wants to merge 1 commit intoOneBusAway:mainfrom
Not-Dhananjay-Mishra:sort

Conversation

@Not-Dhananjay-Mishra
Copy link
Copy Markdown
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra commented Apr 3, 2026

Changes

  • Replaced sort.Ints, sort.Slice, sort.Float64s and sort.Strings usage with slices.Sort and slices.SortFunc for sorting operations.

Improvement

  • Adopted slices.Sort, which is the idiomatic approach in modern Go (introduced in Go 1.21).
  • Reduced heap allocations due to more efficient implementation.
  • Aligned with Go 1.22+ behavior, where sort.Ints internally delegates to slices.Sort (see https://pkg.go.dev/sort#Ints).
  • Improved code readability and future compatibility with the standard library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant