[Python-Dev] PyObject_CallFunction(func, "O", arg) special case

Annapoornima Koppad annakoppad at gmail.com
Fri Dec 9 13:08:24 EST 2016


I am not sure, but soon, I will be a great fan of your work, once I get to
work on this!

Thank your for inspiring me to work on these stuff!

Best regards,
Annapoornima

On Fri, Dec 9, 2016 at 11:33 PM, Victor Stinner <victor.stinner at gmail.com>
wrote:

> 2016-12-09 18:46 GMT+01:00 Victor Stinner <victor.stinner at gmail.com>:
> > Last days, I patched functions of PyObject_CallFunction() family to
> > use internally fast calls.
> > (...)
> > http://bugs.python.org/issue28915
>
> Oh, I forgot to mention the performance results of these changes.
> Python slots are now a little bit faster. Extract of the issue:
> http://bugs.python.org/issue28915#msg282748
>
> Microbenchmark on a simple class with an __int__() method, call int(o):
> int(o): Median +- std dev: [ref] 239 ns +- 13 ns -> [patch] 219 ns +-
> 14 ns: 1.10x faster (-9%)
>
> Microbenchmark on a simple class with an __getitem__() method, call o[100]:
> o[100]: Median +- std dev: [ref] 211 ns +- 11 ns -> [patch] 172 ns +-
> 11 ns: 1.23x faster (-19%)
>
>
> Comparison between Python 2.7, 3.5, 3.7 and 3.7+patch, 3.5 is used as
> the reference:
>
> int(o)
> ======
>
> Median +- std dev: [3.5] 271 ns +- 15 ns -> [3.7] 239 ns +- 13 ns:
> 1.13x faster (-12%)
> Median +- std dev: [3.5] 271 ns +- 15 ns -> [patch] 219 ns +- 14 ns:
> 1.24x faster (-19%)
> Median +- std dev: [3.5] 271 ns +- 15 ns -> [2.7] 401 ns +- 21 ns:
> 1.48x slower (+48%)
>
> o[100]
> ======
>
> Median +- std dev: [3.5] 206 ns +- 5 ns -> [3.7] 211 ns +- 11 ns:
> 1.02x slower (+2%)
> Not significant!
> Median +- std dev: [3.5] 206 ns +- 5 ns -> [patch] 172 ns +- 11 ns:
> 1.20x faster (-17%)
> Median +- std dev: [3.5] 206 ns +- 5 ns -> [2.7] 254 ns +- 15 ns:
> 1.23x slower (+23%)
>
> Victor
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> annakoppad%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20161209/1037b029/attachment-0001.html>


More information about the Python-Dev mailing list