[issue27535] Ignored ResourceWarning warnings leak memory in warnings registries

STINNER Victor report at bugs.python.org
Fri Nov 24 16:17:29 EST 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

New benchmark on the emitting a warning which is ignored. Benchmark the PR 4489.


Warning emitted in Python, warnings.warn():

vstinner at apu$ ./python -m perf compare_to master.json ignore.json 
Mean +- std dev: [master] 705 ns +- 24 ns -> [ignore] 838 ns +- 18 ns: 1.19x slower (+19%)

==> +133 ns


Warning emitted in C, PyErr_WarnEx():

vstinner at apu$ python3 -m perf compare_to master2.json ignore2.json 
Mean +- std dev: [master2] 702 ns +- 9 ns -> [ignore2] 723 ns +- 9 ns: 1.03x slower (+3%)

==> +21 ns


C benchmark, attached files:

* bench_c_warn.patch
* bench_ignore_warn_c.py

----------
Added file: https://bugs.python.org/file47286/bench_c_warn.patch

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


More information about the Python-bugs-list mailing list