# Stability of sort()

**URL:** <https://discourse.julialang.org/t/stability-of-sort/89101>\
**Category:** General Usage\
**Tags:** sort\
**Created:** [October 22, 2022, 9:38am UTC](https://discourse.julialang.org/t/stability-of-sort/89101 "2022-10-22T09:38:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [October 22, 2022, 9:38am UTC](https://discourse.julialang.org/t/stability-of-sort/89101/1 "2022-10-22T09:38:19Z")

</div>

Is the `sort` function stable by default, i.e preserving entries that are equal under the comparison function? If not, can I still expect the outcome of `sort` to be independent of the Julia version, say, 1.7 vs 1.8, for reproducibility purposes?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [October 22, 2022, 9:47am UTC](https://discourse.julialang.org/t/stability-of-sort/89101/2 "2022-10-22T09:47:16Z")

</div>

See [Sorting and Related Functions · The Julia Language](https://docs.julialang.org/en/v1/base/sort/#Sorting-Algorithms).

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [October 22, 2022, 10:04am UTC](https://discourse.julialang.org/t/stability-of-sort/89101/3 "2022-10-22T10:04:11Z")

</div>

OK, so essentially yes.
