п'ятниця, 21-лис-2014 08:15:57 ви написали:
This looks very good indeed. As a matter of interest, is there any particular reason you have used 2*b instead of b+b? Might b+b be faster than b*2?
Yes, it is slightly faster, but the effect is indiscernible in total time. But
there is not harm to use b+b.
Also, in various lines, you use //2. Would >>1 be quicker? On reflection, perhaps you have had to use //2 because >>1 cannot be used in those situations.
I thought this effect would be insignificant too. But actually it is measurable (about 10% for some input). Thanks, this optimization is worth to be applied.
-- https://mail.python.org/mailman/listinfo/python-list