Stefan Behnel added the comment:

Benchmark profile after the patch:

         5930670 function calls (5930288 primitive calls) in 3.748 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   519632    0.828    0.000    0.828    0.000 fractions.py:17(gcd)
   519644    0.806    0.000    1.700    0.000 fractions.py:73(__new__)
   319744    0.630    0.000    1.983    0.000 fractions.py:408(_add)
        4    0.393    0.098    3.735    0.934 bm_telco_fractions.py:38(run)
   519616    0.277    0.000    3.316    0.000 fractions.py:381(forward)
   199872    0.275    0.000    0.901    0.000 fractions.py:424(_mul)
  1598720    0.161    0.000    0.161    0.000 fractions.py:285(denominator)
   520257    0.155    0.000    0.155    0.000 {built-in method isinstance}
   959232    0.118    0.000    0.118    0.000 fractions.py:281(numerator)
   519657    0.066    0.000    0.066    0.000 {built-in method __new__ of type 
object at 0x9d1c40}

Note that the gcd() call inside of __new__() now takes about as much time as 
the rest of the __new__() itself. It's clearly still worth optimising that.

----------

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

Reply via email to