Skip to content

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

Merged
fletcherw merged 4 commits into
OneBusAway:mainfrom
Not-Dhananjay-Mishra:sort
Apr 25, 2026
Merged

refactor: replace sort package with slices for improved sorting performance#809
fletcherw merged 4 commits into
OneBusAway:mainfrom
Not-Dhananjay-Mishra:sort

Conversation

@Not-Dhananjay-Mishra

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

Copy link
Copy Markdown
Contributor

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.

@fletcherw

Copy link
Copy Markdown
Collaborator

Thanks for the fix, this makes the code a little clearer and potentially faster which is great.

@fletcherw
fletcherw merged commit fc7a10a into OneBusAway:main Apr 25, 2026
7 checks passed
@Not-Dhananjay-Mishra
Not-Dhananjay-Mishra deleted the sort branch April 25, 2026 04:59
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.

2 participants