[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-24 Thread STINNER Victor
STINNER Victor added the comment: > Tuples use a freelist ;-) Honestly, I didn't expect that my "fast call" thing would give any significant speedup. I know that tuple allocator uses a free list. Fast calls allows to avoid INCREF/DECREF on each argument, can use the C stack for short memory a

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-24 Thread Roundup Robot
Roundup Robot added the comment: New changeset 316e5de8a96b by Victor Stinner in branch 'default': method_call() and slot_tp_new() now uses fast call https://hg.python.org/cpython/rev/316e5de8a96b -- nosy: +python-dev ___ Python tracker

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Tuples use a freelist ;-) I think you can safely bump the small array to 7 or 8 elements, to satisfy even more cases. Though you are right that function calls with more than 5 arguments should be rare (and mostly to complicated functions where function call ov

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-23 Thread STINNER Victor
STINNER Victor added the comment: Stefan Behnel added the comment: > If you care so much about C stack space, you could also try to create two or > three entry point functions that keep (say) a 4, 8 and 16 items array on the > stack respectively, (...) I should compute statistics, but I'm quit

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-23 Thread Stefan Behnel
Stefan Behnel added the comment: If you care so much about C stack space, you could also try to create two or three entry point functions that keep (say) a 4, 8 and 16 items array on the stack respectively, and then pass the pointer (and the overall length if you need it) of that array on into

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-23 Thread STINNER Victor
STINNER Victor added the comment: > It uses a small buffer allocated on the stack C if the function is called > with 4 arguments or less, or it allocates a buffer in the heap memory. Maybe 4 is too small. On 64 bit, it's just 5*8=40 bytes. Maybe we can use a buffer of 10 pointers: 80 bytes? It

[issue27841] Use fast call in method_call() and slot_tp_new()

2016-08-23 Thread STINNER Victor
New submission from STINNER Victor: Attached patch avoids the creation of a temporary tuple in method_call() and slot_tp_new() by using the new fast call calling convention. It uses a small buffer allocated on the stack C if the function is called with 4 arguments or less, or it allocates a bu