Javascript Array.sort implementation?

后端 未结 9 1695
难免孤独
难免孤独 2020-11-22 06:58

Which algorithm does the JavaScript Array#sort() function use? I understand that it can take all manner of arguments and functions to perform different kinds o

9条回答
  •  既然无缘
    2020-11-22 07:29

    As of V8 v7.0 / Chrome 70, V8 uses TimSort, Python's sorting algorithm. Chrome 70 was released on September 13, 2018.

    See the the post on the V8 dev blog for details about this change. You can also read the source code or patch 1186801.

提交回复
热议问题