Commit 2d466332 authored by Stefan Behnel's avatar Stefan Behnel

optimise call to asyncio "firstiter" method for async generators

parent 49d0e464
...@@ -100,6 +100,7 @@ static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) { ...@@ -100,6 +100,7 @@ static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) {
//////////////////// AsyncGenerator //////////////////// //////////////////// AsyncGenerator ////////////////////
//@requires: AsyncGeneratorInitFinalizer //@requires: AsyncGeneratorInitFinalizer
//@requires: Coroutine.c::Coroutine //@requires: Coroutine.c::Coroutine
//@requires: ObjectHandling.c::PyObjectCallMethod1
PyDoc_STRVAR(__Pyx_async_gen_send_doc, PyDoc_STRVAR(__Pyx_async_gen_send_doc,
...@@ -222,7 +223,8 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) ...@@ -222,7 +223,8 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
PyObject *res; PyObject *res;
Py_INCREF(firstiter); Py_INCREF(firstiter);
res = __Pyx_PyObject_CallOneArg(firstiter, (PyObject*)o); // at least asyncio stores methods here => optimise the call
res = __Pyx__PyObject_CallMethod1(firstiter, (PyObject*)o);
Py_DECREF(firstiter); Py_DECREF(firstiter);
if (unlikely(res == NULL)) { if (unlikely(res == NULL)) {
return 1; return 1;
......
...@@ -1268,6 +1268,7 @@ bad: ...@@ -1268,6 +1268,7 @@ bad:
/////////////// PyObjectCallMethod1.proto /////////////// /////////////// PyObjectCallMethod1.proto ///////////////
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /*proto*/ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /*proto*/
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg); /*proto*/
/////////////// PyObjectCallMethod1 /////////////// /////////////// PyObjectCallMethod1 ///////////////
//@requires: PyObjectGetAttrStr //@requires: PyObjectGetAttrStr
...@@ -1275,10 +1276,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name ...@@ -1275,10 +1276,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
//@requires: PyFunctionFastCall //@requires: PyFunctionFastCall
//@requires: PyCFunctionFastCall //@requires: PyCFunctionFastCall
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
PyObject *method, *result = NULL; PyObject *result;
method = __Pyx_PyObject_GetAttrStr(obj, method_name);
if (unlikely(!method)) goto done;
#if CYTHON_UNPACK_METHODS #if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method))) { if (likely(PyMethod_Check(method))) {
PyObject *self = PyMethod_GET_SELF(method); PyObject *self = PyMethod_GET_SELF(method);
...@@ -1315,6 +1314,15 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name ...@@ -1315,6 +1314,15 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
} }
#endif #endif
result = __Pyx_PyObject_CallOneArg(method, arg); result = __Pyx_PyObject_CallOneArg(method, arg);
done:
return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
PyObject *method, *result;
method = __Pyx_PyObject_GetAttrStr(obj, method_name);
if (unlikely(!method)) goto done;
result = __Pyx__PyObject_CallMethod1(method, arg);
done: done:
Py_XDECREF(method); Py_XDECREF(method);
return result; return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment