@@ -8,43 +8,38 @@ simplicity, accuracy and safety. Clearly not in terms of speed, though,
8
8
given the cdecimal accelerator in Python 3.3+.
9
9
10
10
``quicktions `` is an adaptation of the original ``fractions `` module
11
- (as included in CPython 3.13a3 ) that is compiled and optimised with
11
+ (as included in CPython 3.13 ) that is compiled and optimised with
12
12
`Cython <https://cython.org/ >`_ into a fast, native extension module.
13
13
14
- Compared to the standard library ``fractions `` module of CPython,
15
- computations in ``quicktions `` are about
14
+ Compared to the standard library ``fractions `` module of CPython 3.12 ,
15
+ computations in ``quicktions `` are about 3-4x faster.
16
16
17
- - 10x faster in Python 2.7 and 3.4
18
- - 6x faster in Python 3.5
19
- - 3-4x faster in Python 3.10
20
-
21
- Compared to the ``fractions `` module in CPython 3.10, instantiation of a
22
- ``Fraction `` in ``quicktions `` is also
17
+ Instantiation of a ``Fraction `` in ``quicktions `` is also
23
18
24
19
- 5-15x faster from a floating point string value (e.g. ``Fraction("123.456789") ``)
25
20
- 3-5x faster from a floating point value (e.g. ``Fraction(123.456789) ``)
26
- - 2-4x faster from an integer numerator-denominator pair (e.g. ``Fraction(123, 456) ``)
21
+ - 2-5x faster from an integer numerator-denominator pair (e.g. ``Fraction(123, 456) ``)
27
22
28
23
We provide a set of micro-benchmarks here:
29
24
30
25
https://github.com/scoder/quicktions/tree/master/benchmark
31
26
32
- As of quicktions 1.12 , the different number types and implementations compare
33
- as follows in CPython 3.10 :
27
+ As of quicktions 1.19 , the different number types and implementations compare
28
+ as follows in CPython 3.12 (measured on Ubuntu Linux) :
34
29
35
30
.. code-block ::
36
31
37
32
Average times for all 'create' benchmarks:
38
- float : 36.17 us (1.0x)
39
- Decimal : 111.71 us (3.1x )
40
- Fraction : 111.98 us (3.1x )
41
- PyFraction : 398.80 us (11.0x )
33
+ float : 33.55 us (1.0x)
34
+ Fraction : 116.02 us (3.5x )
35
+ Decimal : 132.22 us (3.9x )
36
+ PyFraction : 361.93 us (10.8x )
42
37
43
38
Average times for all 'compute' benchmarks:
44
- float : 4.53 us (1.0x)
45
- Decimal : 16.62 us (3.7x )
46
- Fraction : 72.91 us (16.1x )
47
- PyFraction : 251.93 us (55.6x )
39
+ float : 3.24 us (1.0x)
40
+ Decimal : 17.28 us (5.3x )
41
+ Fraction : 77.04 us (23.8x )
42
+ PyFraction : 166.38 us (51.2x )
48
43
49
44
While not as fast as the C implemented ``decimal `` module in Python 3,
50
45
``quicktions `` is about 15x faster than the Python implemented ``decimal ``
0 commit comments