STINNER Victor <vstin...@python.org> added the comment:

I wrote a microbenchmark on Py_INCREF()+Py_DECREF():

$ python3 -m pyperf compare_to ref.json limited.json 
Mean +- std dev: [ref] 3.45 ns +- 0.17 ns -> [limited] 6.03 ns +- 0.21 ns: 
1.75x slower

If a function is only made of Py_INCREF() and Py_DECREF(), it can be up to 1.8x 
slower in the worst case. But in practice, I don't think that functions are 
only made of Py_INCREF() and Py_DECREF(). They do a few other things.

I'm not sure how to run a "macro benchmark" on my PR 25131, since I don't know 
any C extension doing anything useful. There is xxlimited, but it does almost 
nothing.

What would be a fair benchmark for this change?

--

To run my microbenchmark:

git apply bench.patch
./configure --with-lto --enable-optimizations
make
./python -m venv env
./env/bin/python -m pip install pyperf
./env/bin/python ../bench_limited.py -o ../limited.json -v
./env/bin/python ../bench_testcapi.py -o ../ref.json -v

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43688>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to