News for hackers. Stuff that matters.
Re:Why is it faster to process a sorted array than an unsort... by hyperpape on Friday September 15, 2017 @10:37AM (#15257494)
You can't use the Python implementation to get insight into what's happening with a C++ implementation, because the overhead of operations in Python may mask a real effect that can be seen in C++.
Re:Why is it faster to process a sorted array than an unsort... by autokad on Friday September 15, 2017 @12:28PM (#15258418)
not directly, but information is information. I am also more skeptical that branching alone would result in a 6x increase in run time.

We know optimizes unfold loops as well as arrays. it doesnt take a profound leap in logic that the optimizer may have unfolded everything and realized certain code was not going to change the state of the program, thus removed it. Maybe it didnt, but then again maybe it did.

Re:Why is it faster to process a sorted array than an unsort... by hyperpape on Friday September 15, 2017 @01:18PM (#15258905)
> information is information

It's information, but not worthwhile information.

> It doesnt take a profound leap in logic that the optimizer may have unfolded everything and realized certain code was not going to change the state of the program, thus removed it. Maybe it didnt, but then again maybe it did.

Prove it. This article has had a ton of traffic. If you see the thing that everyone missed, a lot of people will be very impressed with you.

Re:Why is it faster to process a sorted array than an unsort... by Ultimatt on Sunday September 17, 2017 @05:26AM (#15268863)
Did you try with an actual array or a Python list? https://docs.python.org/3/library/array.html or numpy you might be able to recover the same effect. Your average line of Python is miles away from low level and simple operations. Pretty much any dynamic language with a large runtime is. Especially when they default to lists not arrays. You should see your result as evidence of that. Not assume this discussion is flawed.