This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients methane, ncoghlan, rhettinger, serhiy.storchaka, vstinner, yselivanov
Date 2017-03-14.12:08:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489493292.78.0.371045902683.issue29735@psf.upfronthosting.co.za>
In-reply-to
Content
bench_fastcall_partial.py: more complete microbenchmark.

I rewrote my patch:

* I added _PyObject_HasFastCall(callable): return 1 if callable supports FASTCALL calling convention for positional arguments
* I splitted partial_call() into 2 subfunctions: partial_fastcall() is specialized for FASTCALL, partial_call_impl() uses PyObject_Call() with a tuple for positional arguments

The patch fixes the performance regression for VARARGS and optimize FASTCALL:

haypo@smithers$ ./python -m perf compare_to ref.json patch.json --table 
+-----------------------------+---------+------------------------------+
| Benchmark                   | ref     | patch                        |
+=============================+=========+==============================+
| partial Python, 1+1 arg     | 135 ns  | 118 ns: 1.15x faster (-13%)  |
+-----------------------------+---------+------------------------------+
| partial Python, 2+0 arg     | 114 ns  | 91.4 ns: 1.25x faster (-20%) |
+-----------------------------+---------+------------------------------+
| partial Python, 5+1 arg     | 151 ns  | 135 ns: 1.12x faster (-11%)  |
+-----------------------------+---------+------------------------------+
| partial Python, 5+5 arg     | 192 ns  | 168 ns: 1.15x faster (-13%)  |
+-----------------------------+---------+------------------------------+
| partial C VARARGS, 2+0 arg  | 153 ns  | 127 ns: 1.20x faster (-17%)  |
+-----------------------------+---------+------------------------------+
| partial C FASTCALL, 1+1 arg | 111 ns  | 93.7 ns: 1.18x faster (-15%) |
+-----------------------------+---------+------------------------------+
| partial C FASTCALL, 2+0 arg | 63.9 ns | 64.6 ns: 1.01x slower (+1%)  |
+-----------------------------+---------+------------------------------+

Not significant (1): partial C VARARGS, 1+1 arg
History
Date User Action Args
2017-03-14 12:08:12vstinnersetrecipients: + vstinner, rhettinger, ncoghlan, methane, serhiy.storchaka, yselivanov
2017-03-14 12:08:12vstinnersetmessageid: <1489493292.78.0.371045902683.issue29735@psf.upfronthosting.co.za>
2017-03-14 12:08:12vstinnerlinkissue29735 messages
2017-03-14 12:08:12vstinnercreate