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

后端 未结 5 2241
说谎
说谎 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:40

    Click here to see more answers and similar question. The reason why the performance improves drastically when the data are sorted is that the branch prediction penalty is removed, as explained beautifully in Mysticial's answer.

提交回复
热议问题