On 08Jul2019 1216, Jeroen Demeyer wrote:
On 2019-06-19 20:49, Brett Cannon wrote:
I agree with both of what Victor said: let's see if a one-arg version has a benefit and the counts for the other possibilities don't seem to me to be high enough to bother with the analysis.
We now have (uses counted in all .c files):
- _PyObject_CallNoArg and PyObject_CallNoArgs (84 uses)
- _PyObject_CallOneArg (96 uses)
- _PyObject_CallMethodNoArgs (34 uses)
To complement these, I like to add _PyObject_CallMethodOneArg, which would have 39 uses if I counted correctly.
Did we try it and see if there's an actual performance benefit? (I dislike guessing what compilers are doing here, or even looking at the generated code, as processors can often perform better with code that looks unintuitive to a human reader.)
I would also appreciate if we included more than just gcc as the benchmark for "what compilers do". Adding clang would satisfy me, though of course I'd be happiest if MSVC was also tested.
In general, I prefer to not expand even the internal C API unless there's a significant benefit, and the burden of proof is on those who are proposing the expansion.