Dear list!

I noticed that integer division (`//`) is slower than floating-point
division and integer cast. For example:

    from __future__ import division
    from time import time
    t = time()
    for i in range(1, 10000):
        for j in range(1, 10000):
            # k = i//j # 2.12 seconds
            k = int(i/j) # 0.98 seconds
    print time() - t

I now integer division should be slower, but I thought that the
`int()` would make floating division even slower.

Please, can someone explain what is going on? Is this expected behaviour?

Thank you!
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to