etcd-io / raft

Raft library for maintaining a replicated state machine
Apache License 2.0
630 stars 160 forks source link

tracker,quorum: use native Sort #172

Closed pav-kv closed 6 months ago

pav-kv commented 6 months ago

The insertion sort is no longer needed, since Go 1.21 introduced a generic slices.Sort algorithm which achieves the same effect: it doesn't incur allocations, and uses insertion sort for slices up to 12 elements.

ahrtr commented 6 months ago

Note: This PR will require the applications, which depend on raft, to use a go version >= 1.21. It shouldn't be a problem, because go1.20 is already out of support. But we should document the requirement in readme.

pav-kv commented 6 months ago

go.mod already states 1.21, plus some other 1.21+ things are already used (e.g. #135). Seems like this PR isn't the best place to update documentation.

ahrtr commented 6 months ago

go.mod already states 1.21

It doesn't technically prevent applications, which depend on raft, from using a old go version.

some other 1.21+ things are already used (e.g. #135). Seems like this PR isn't the best place to update documentation.

OK. We can take care of the document separately.