In python language, is there any difference between ‘>>’ operator and ‘/’ operator in terms of execution time, when we are going to divide any Integer by multiple of ‘2’ and why?
In python language, is there any difference between ‘>>’ operator and ‘/’ operator in
Share
Default Python implementation has so incredibly much overhead that it is wrong language if you care about things like this. These slides from Unladen Swallow presentation are pretty illuminating…
As a matter of fact, the
>>will be faster than/. But this is not from the cost of doing the division, but from the overhead of figuring out whether you are about to divide a float or an integer! If you instead divide by//(which assumes int), that will be as fast as the>>…