Why is processing a sorted array not faster than an unsorted array in Python?

后端 未结 5 2250
说谎
说谎 2021-02-13 10:27

In this post Why is processing a sorted array faster than random array, it says that branch predicton is the reason of the performance boost in sorted arrays.

But I just

5条回答
  •  死守一世寂寞
    2021-02-13 10:42

    sorted() returns a sorted array rather than sorting in place. You're actually measuring the same array twice.

提交回复
热议问题