Mark Dickinson added the comment:

Timing results on my machine:

(Canopy 64bit) taniyama:~ mdickinson$ python3 -m timeit -s "from math import 
sqrt; x = 3.14" "sqrt(x)"
10000000 loops, best of 3: 0.0426 usec per loop
(Canopy 64bit) taniyama:~ mdickinson$ python3 -m timeit -s "from math import 
sqrt; x = 3.14" "x**0.5"
10000000 loops, best of 3: 0.0673 usec per loop

And the disassembly showing the peephole optimizer at work:

>>> def f(): return 3.14**0.5
... 
>>> import dis
>>> dis.dis(f)
  1           0 LOAD_CONST               3 (1.772004514666935)
              3 RETURN_VALUE

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24059>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to