File tree Expand file tree Collapse file tree
pyperformance/data-files/benchmarks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,26 @@ See `pyaes <https://github.com/ricmoo/pyaes>`_: A pure-Python implementation of
169169the AES block cipher algorithm and the common modes of operation (CBC, CFB,
170170CTR, ECB and OFB).
171171
172+ decimal_factorial
173+ -----------------
174+
175+ Compute ``10000! `` and ``100000! `` exactly with the ``decimal `` module, using
176+ binary splitting.
177+
178+ This benchmark is skipped on PyPy, where the pure-Python ``decimal `` module
179+ hangs at this precision (see `pypy/pypy#5814
180+ <https://github.com/pypy/pypy/issues/5814> `_).
181+
182+ decimal_pi
183+ ----------
184+
185+ Compute ``pi `` with the ``decimal `` module at context precisions of 9 and 19
186+ digits.
187+
188+ This measures the speed of many operations on small ``Decimal `` values.
189+ See also the ``pidigits `` benchmark, which does a similar computation
190+ with ``int ``.
191+
172192deepcopy
173193--------
174194
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ Version 2.0.0 (unreleased)
1919 and its results are mostly noise
2020* Fix benchmark selection checking Python version requirements against the
2121 running interpreter instead of the target specified by ``--python ``
22+ * Enable the ``decimal_factorial `` and ``decimal_pi `` benchmarks, which were
23+ added in 1.12.0 but never listed in the manifest. ``decimal_factorial `` is
24+ skipped on PyPy.
2225
2326Version 1.14.0 (2026-02-07)
2427---------------------------
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ chaos <local>
3939comprehensions <local>
4040crypto_pyaes <local>
4141dask <local>
42+ decimal_factorial <local>
43+ decimal_pi <local>
4244deepcopy <local>
4345deltablue <local>
4446django_template <local>
Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ dynamic = ["version"]
88[tool .pyperformance ]
99name = " decimal_factorial"
1010tags = " decimal"
11+ unsupported_implementations = [" pypy" ] # pypy/pypy#5814
Original file line number Diff line number Diff line change 44- 2024-06-14: Michael Droettboom copied this from
55 Modules/_decimal/tests/bench.py in the CPython source and adapted to use
66 pyperf.
7+ - 2026-12-01: Sergey B Kirpichev, use sys.set_int_max_str_digits(0).
78"""
89
910# Original copyright notice in CPython source:
1516
1617
1718import decimal
19+ import sys
1820
1921
2022import pyperf
@@ -38,11 +40,12 @@ def bench_decimal_factorial():
3840 c .Emin = decimal .MIN_EMIN
3941
4042 for n in [10000 , 100000 ]:
41- # C version of decimal
4243 _ = factorial (decimal .Decimal (n ), 0 )
4344
4445
4546if __name__ == "__main__" :
47+ sys .set_int_max_str_digits (0 )
48+
4649 runner = pyperf .Runner ()
4750 runner .metadata ["description" ] = "decimal_factorial benchmark"
4851
You can’t perform that action at this time.
0 commit comments