[issue35588] Speed up mod/divmod/floordiv for Fraction type

Stefan Behnel report at bugs.python.org
Wed Dec 26 07:44:18 EST 2018


Stefan Behnel <stefan_ml at behnel.de> added the comment:

Motivation for the latter:

$ ./python -m timeit -s 'from fractions import Fraction as F; a = F(-7, 3); b = F(3, 2)' 'a // b'
100000 loops, best of 5: 3.7 usec per loop
$ ./python -m timeit -s 'from fractions import Fraction as F; a = F(-7, 3); b = F(3, 2)' 'a // 3'
100000 loops, best of 5: 3.49 usec per loop

$ ./python -m timeit -s 'from fractions import Fraction as F; a = F(-7, 3); b = F(3, 2)' 'a // b'
500000 loops, best of 5: 899 nsec per loop
$ ./python -m timeit -s 'from fractions import Fraction as F; a = F(-7, 3); b = F(3, 2)' 'a // 3'
500000 loops, best of 5: 729 nsec per loop

----------
title: Speed up mod/divmod for Fraction type -> Speed up mod/divmod/floordiv for Fraction type

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35588>
_______________________________________


More information about the Python-bugs-list mailing list