diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2019-01-02 12:22:06 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-01-02 12:22:06 (GMT) |
commit | 3a374e0c5abe805667b71ffaaa7614781101ff4c (patch) | |
tree | 5b88e9c84d19b725996059a1713d9b1536028980 /Mac | |
parent | a1d14253066f7dd60cfb465c6511fa565f312b42 (diff) | |
download | cpython-3a374e0c5abe805667b71ffaaa7614781101ff4c.zip cpython-3a374e0c5abe805667b71ffaaa7614781101ff4c.tar.gz cpython-3a374e0c5abe805667b71ffaaa7614781101ff4c.tar.bz2 |
bpo-35588: Speed up mod, divmod and floordiv operations for Fraction type (#11322)
* bpo-35588: Implement mod and divmod operations for Fraction type by spelling out the numerator/denominator calculation, instead of instantiating and normalising Fractions along the way. This speeds up '%' and divmod() by 2-3x.
* bpo-35588: Also reimplement Fraction.__floordiv__() using integer operations to make it ~4x faster.
* Improve code formatting.
Co-Authored-By: scoder <stefan_ml@behnel.de>
* bpo-35588: Fix return type of divmod(): the result of the integer division should be an integer.
* bpo-35588: Further specialise __mod__() and inline the original helper function _flat_divmod() since it's no longer reused.
* bpo-35588: Add some tests with large numerators and/or denominators.
* bpo-35588: Use builtin "divmod()" function for implementing __divmod__() in order to simplify the implementation, even though performance results are mixed.
* Rremove accidentally added empty line.
* bpo-35588: Try to provide more informative output on test failures.
* bpo-35588: Improve wording in News entry.
Co-Authored-By: scoder <stefan_ml@behnel.de>
* Remove stray space.
Diffstat (limited to 'Mac')
0 files changed, 0 insertions, 0 deletions